0

I have a a jqGrid that shows as list of rows ... several thousand.

When the grid loads, it will pull down all the data with their previous selections already checked.

My questions is, how do I set the sort order to always show the selected items at the top?

Thanks in advance!!

Rob W
  • 341,306
  • 83
  • 791
  • 678

1 Answers1

1

You question seems be very close to another one which I answered recently (see here). If you has several thousand or event thousand rows you should use paging of date to improve performance of the grid. The solution which I suggested is very simple and it supports saving of selected state over the paging.

One more remark. If you have jqGrid with local data you can implement custom sorting of data. To do this you just need define sorttype as function. If the data need be sorted by a column jqGrid will compare items. The function sorttype should just return any string or number which should be used instead of the cell value. In the case you can easy place for example selected items at the top of grid. You can find examples of custom formatting here, here and here.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • This truly answers my question, however, I want to keep the select all feature. – Adam Adam Adam Nov 17 '11 at 22:11
  • @Adam: If you read my previous answer you will understand that you need just comment in the demo lines starting with `$("#cb_" + $grid[0].id).hide();`. Then you will have select all feature. You should implement custom sorting of data `sorttype` as function to hold the selected items on top. – Oleg Nov 18 '11 at 06:27
  • I did notice that in the example, however it does not let the select all function work. When I click the checkbox, it sorts the column instead of selecting all. – Adam Adam Adam Nov 19 '11 at 02:34