Renamed always_visible_rows option exlucde_rows
This commit is contained in:
parent
e855fc5bbd
commit
4428f7b48b
|
@ -8144,7 +8144,6 @@ var TableFilter = exports.TableFilter = function () {
|
|||
}
|
||||
|
||||
this.onRowValidated(this, rowIndex);
|
||||
|
||||
this.emitter.emit('row-validated', this, rowIndex);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2419,7 +2419,6 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
this.onRowValidated(this, rowIndex);
|
||||
|
||||
this.emitter.emit('row-validated', this, rowIndex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>TableFilter excluded rows tests</title>
|
||||
<link rel="stylesheet" href="libs/qunit/qunit.css">
|
||||
<script src="libs/qunit/qunit.js"></script>
|
||||
<script src="libs/polyfill.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<table id="demo" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>Destination</th>
|
||||
<th>Road Distance (km)</th>
|
||||
<th>By Air (hrs)</th>
|
||||
<th>By Rail (hrs)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Sydney</strong></td>
|
||||
<td>Adelaide</td>
|
||||
<td>1412</td>
|
||||
<td>1.4</td>
|
||||
<td>25.3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Sydney</strong></td>
|
||||
<td>Brisbane</td>
|
||||
<td>982</td>
|
||||
<td>1.5</td>
|
||||
<td>16</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Always visible row</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Sydney</strong></td>
|
||||
<td>Canberra</td>
|
||||
<td>286</td>
|
||||
<td>.6</td>
|
||||
<td>4.3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Sydney</strong></td>
|
||||
<td>Melbourne</td>
|
||||
<td>872</td>
|
||||
<td>1.1</td>
|
||||
<td>10.5</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Adelaide</strong></td>
|
||||
<td>Perth</td>
|
||||
<td>2781</td>
|
||||
<td>3.1</td>
|
||||
<td>38</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Adelaide</strong></td>
|
||||
<td>Alice Springs</td>
|
||||
<td>1533</td>
|
||||
<td>2</td>
|
||||
<td>20.25</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Always visible row</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Adelaide</strong></td>
|
||||
<td>Brisbane</td>
|
||||
<td>2045</td>
|
||||
<td>2.15</td>
|
||||
<td>40</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script src="../dist/tablefilter/tablefilter.js"></script>
|
||||
<script src="test-excluded-rows.js"></script>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,116 @@
|
|||
(function(win, TableFilter){
|
||||
var tf = new TableFilter('demo', {
|
||||
base_path: '../dist/tablefilter/',
|
||||
exclude_rows: [4, 9]
|
||||
});
|
||||
tf.init();
|
||||
|
||||
module('Sanity checks');
|
||||
test('Excluded rows', function() {
|
||||
deepEqual(tf instanceof TableFilter, true, 'TableFilter type');
|
||||
deepEqual(tf.hasExcludedRows, true, 'Has excluded rows');
|
||||
deepEqual(tf.excludeRows, [4, 9], 'Excluded rows');
|
||||
});
|
||||
|
||||
module('Behaviour');
|
||||
test('for filtered table', function() {
|
||||
tf.setFilterValue(0, 'Hello');
|
||||
tf.filter();
|
||||
var excludedRow1 = tf.dom().rows[4];
|
||||
var excludedRow2 = tf.dom().rows[9];
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow1),
|
||||
'',
|
||||
'Row display for excludedRow1'
|
||||
);
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow2),
|
||||
'',
|
||||
'Row display for excludedRow2'
|
||||
);
|
||||
});
|
||||
|
||||
test('after filters are cleared', function() {
|
||||
tf.clearFilters();
|
||||
var excludedRow1 = tf.dom().rows[4];
|
||||
var excludedRow2 = tf.dom().rows[9];
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow1),
|
||||
'',
|
||||
'Row display for excludedRow1'
|
||||
);
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow2),
|
||||
'',
|
||||
'Row display for excludedRow2'
|
||||
);
|
||||
|
||||
testPaging();
|
||||
});
|
||||
|
||||
function testPaging(){
|
||||
tf.destroy();
|
||||
tf = new TableFilter('demo', {
|
||||
base_path: '../dist/tablefilter/',
|
||||
exclude_rows: [4, 9],
|
||||
paging: {
|
||||
length: 2
|
||||
}
|
||||
});
|
||||
tf.init();
|
||||
var paging = tf.feature('paging');
|
||||
|
||||
module('Behaviour with paging');
|
||||
test('for filtered table', function() {
|
||||
tf.setFilterValue(0, 'Hello');
|
||||
tf.filter();
|
||||
var excludedRow1 = tf.dom().rows[4];
|
||||
var excludedRow2 = tf.dom().rows[9];
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow1),
|
||||
'',
|
||||
'Row display for excludedRow1'
|
||||
);
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow2),
|
||||
'',
|
||||
'Row display for excludedRow2'
|
||||
);
|
||||
});
|
||||
|
||||
test('after filters are cleared', function() {
|
||||
tf.clearFilters();
|
||||
var excludedRow1 = tf.dom().rows[4];
|
||||
var excludedRow2 = tf.dom().rows[9];
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow1),
|
||||
'none',
|
||||
'Row display for excludedRow1'
|
||||
);
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow2),
|
||||
'none',
|
||||
'Row display for excludedRow2'
|
||||
);
|
||||
});
|
||||
|
||||
test('after changing pagination page', function() {
|
||||
paging.setPage(2);
|
||||
var excludedRow1 = tf.dom().rows[4];
|
||||
var excludedRow2 = tf.dom().rows[9];
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow1),
|
||||
'',
|
||||
'Row display for excludedRow1'
|
||||
);
|
||||
deepEqual(
|
||||
tf.getRowDisplay(excludedRow2),
|
||||
'none',
|
||||
'Row display for excludedRow2'
|
||||
);
|
||||
|
||||
tf.destroy();
|
||||
});
|
||||
}
|
||||
|
||||
})(window, TableFilter);
|
Loading…
Reference in New Issue