开发者

How to remember the previous sorting order in jQuery Table sorting

I'm using jQuery for sorting the tables.

I open a page and click a columns to sort in desc or asc order and in the same page I click on a sub link to view some related data. Then I click back and come back to my same page (page1). At that moment the sorting which i d开发者_运维问答id before I click the sub link is not there. I want the sorting to be remembered when I click the back button.

Example: Page1 has column names as : Id, Name, Total_Marks. (Here Total_Marks have a link which opens a page for detailed marks(page2). The page2 has a back button which will redirect to page1.)

  • Step 1 : I sort the Name column in descending order.
  • Step 2 : I click on the Total_Marks link and navigate to next page for detailed report.
  • Step 3 : Now Im coming back to page1 by clicking the back button link.

Now the table in the page1 should be sorted by Name in descending order. (As i did before leaving the page1 to page2)

Is there a solution for this?


One option is to display your page of related data in a jQuery UI .dialog() instead of on a separate page. Then the user, instead of clicking the back button, simply dismisses the jQ dialog. The underlying page has not changed. This may be much easier than setting up a structure to maintain state: obtain it in $(document).ready(), update it on every change in sort order, etc.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜