开发者

jQuery TableSorter Remember Sort Preferences?

Is it po开发者_JS百科ssible to somehow store or cache sort preferences. Even if I can store them into a php session or anything where I can associate the current search (it's returning search results) and it's sort preferences so I can go back and see stuff in order...

Any way to do this?

Thanks!


Well you can specify a sort when you set up the tablesorter, like this:

$("table").tablesorter({         
      // sort on the first column and third column, order asc         
      sortList: [[0,0],[2,0]]     
}); 

So if you store that object and pass it to the sortList option, sure!


I have a saveSort widget included with my fork of tablesorter; it saves the sort to local storage with a cookie fallback; it will work with the original plugin, just include the jquery.tablesorter.widgets.min.js file and add the widget id to the initialization code: demo

$("table").tablesorter({ 
  widgets: ["saveSort"] 
}); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜