1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2026-03-17 16:10:04 +01:00

Fixed issue #70, paging sort when column is filtered

This commit is contained in:
Max Guglielmi 2015-12-20 16:58:39 +11:00
commit f399dc85ec
33 changed files with 83 additions and 592 deletions

View file

@ -35,16 +35,6 @@ export default class AdapterSortableTable{
//cell attribute storing custom key
this.customKey = opts.custom_key || 'data-tf-sortKey';
/*** TF additional events ***/
//additional paging events for alternating background
// o.Evt._Paging.nextEvt = function(){
// if(o.sorted && o.alternateRows) o.Filter();
// }
// o.Evt._Paging.prevEvt = o.Evt._Paging.nextEvt;
// o.Evt._Paging.firstEvt = o.Evt._Paging.nextEvt;
// o.Evt._Paging.lastEvt = o.Evt._Paging.nextEvt;
// o.Evt._OnSlcPagesChangeEvt = o.Evt._Paging.nextEvt;
// callback invoked after sort is loaded and instanciated
this.onSortLoaded = Types.isFn(opts.on_sort_loaded) ?
opts.on_sort_loaded : null;
@ -134,6 +124,8 @@ export default class AdapterSortableTable{
//sort behaviour for paging
if(tf.paging){
let paginator = tf.feature('paging');
// recalculate valid rows index as sorting may have change it
tf.getValidRows(true);
paginator.enable();
paginator.setPage(paginator.getPage());
}

View file

@ -417,10 +417,10 @@ export class Paging extends Feature{
*/
groupByPage(validRows){
var tf = this.tf;
var alternateRows = tf.feature('alternateRows');
var alternateRows = tf.feature('alternateRows');
var rows = tf.tbl.rows;
var endPagingRow = parseInt(this.startPagingRow, 10) +
parseInt(this.pagingLength, 10);
var startPagingRow = parseInt(this.startPagingRow, 10);
var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10);
//store valid rows indexes
if(validRows){
@ -433,7 +433,7 @@ export class Paging extends Feature{
var r = rows[validRowIdx];
var isRowValid = r.getAttribute('validRow');
if(h>=this.startPagingRow && h<endPagingRow){
if(h>=startPagingRow && h<endPagingRow){
if(Types.isNull(isRowValid) || Boolean(isRowValid==='true')){
r.style.display = '';
}
@ -473,7 +473,7 @@ export class Paging extends Feature{
}
var btnEvt = this.evt,
cmdtype = typeof cmd;
if(cmdtype==='string'){
if(cmdtype === 'string'){
switch(Str.lower(cmd)){
case 'next':
btnEvt.next();
@ -492,7 +492,7 @@ export class Paging extends Feature{
break;
}
}
else if(cmdtype==='number'){
else if(cmdtype === 'number'){
this.changePage(cmd-1);
}
}

View file

@ -1857,7 +1857,6 @@ export class TableFilter{
// TODO: provide a method in paging module
Mod.paging.startPagingRow = 0;
Mod.paging.currentPageNb = 1;
//
Mod.paging.setPagingInfo(this.validRowsIndex);
}
//invokes onafter callback