You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
since there was no way to save a filter (like the savesort widget), i wrote my own little widget. maybe it is of some use to you.
$.tablesorter.addWidget({id: 'FilterSave',format: function(table,init){varsl,time,c=table.config,wo=c.widgetOptions,ss=wo.FilterSave!==false;// make FilterSave active/inactive; default to truevarcount_filters=$(table).find('input.tablesorter-filter').length;varfilter=newArray();for(vari=0;i<count_filters;i++){filter[i]=$(table).find('input.tablesorter-filter').eq(i).val();}if(c.debug){time=newDate();}if($(table).hasClass('hasSaveFilter')){if(ss&&table.hasInitialized&&$.tablesorter.storage){$.tablesorter.storage(table,'tablesorter-savefilter',filter);// console.log("saved"+filter)if(c.debug){$.tablesorter.benchmark('FilterSave widget: Saving last filter: '+filter,time);}}}elseif(table.hasInitialized){// set table sort on initial run of the widget$(table).addClass('hasSaveFilter');filter='';// get dataif($.tablesorter.storage){fl=$.tablesorter.storage(table,'tablesorter-savefilter');filter=(fl&&$.isArray(fl)) ? fl : '';if(c.debug){$.tablesorter.benchmark('FilterSave: Last filter loaded: "'+filter+'"',time);}}// init is true when widget init is run, this will run this widget before all other widgets have initialized// this method allows using this widget in the original tablesorter plugin; but then it will run all widgets twice.if(filter&&filter.length>0){$(table).trigger('search',[filter]);}}},remove: function(table,c,wo){// clear storage$.tablesorter.storage(table,'tablesorter-savefilter','');}});
The text was updated successfully, but these errors were encountered:
Hi,
since there was no way to save a filter (like the savesort widget), i wrote my own little widget. maybe it is of some use to you.
The text was updated successfully, but these errors were encountered: