mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-05 16:13:34 +02:00
Renamed always_visible_rows option exlucde_rows
This commit is contained in:
parent
e855fc5bbd
commit
4428f7b48b
1
dist/tablefilter/tablefilter.js
vendored
1
dist/tablefilter/tablefilter.js
vendored
|
@ -8144,7 +8144,6 @@ var TableFilter = exports.TableFilter = function () {
|
|||
}
|
||||
|
||||
this.onRowValidated(this, rowIndex);
|
||||
|
||||
this.emitter.emit('row-validated', this, rowIndex);
|
||||
}
|
||||
}
|
||||
|
|
2
dist/tablefilter/tablefilter.js.map
vendored
2
dist/tablefilter/tablefilter.js.map
vendored
File diff suppressed because one or more lines are too long
3342
dist/tablefilter/tf-0-38dc627fe8179bc04a38.js
vendored
Normal file
3342
dist/tablefilter/tf-0-38dc627fe8179bc04a38.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/tablefilter/tf-0-38dc627fe8179bc04a38.js.map
vendored
Normal file
1
dist/tablefilter/tf-0-38dc627fe8179bc04a38.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
522
dist/tablefilter/tf-0-7f3395426b0f24b91c53.js
vendored
Normal file
522
dist/tablefilter/tf-0-7f3395426b0f24b91c53.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/tablefilter/tf-0-7f3395426b0f24b91c53.js.map
vendored
Normal file
1
dist/tablefilter/tf-0-7f3395426b0f24b91c53.js.map
vendored
Normal file
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);
|
||||
}
|
||||
}
|
||||
|
|
92
test/test-excluded-rows.html
Normal file
92
test/test-excluded-rows.html
Normal file
|
@ -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>
|
116
test/test-excluded-rows.js
Normal file
116
test/test-excluded-rows.js
Normal file
|
@ -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 a new issue