ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: mshapiro on April 29, 2015, 05:48:19 am
-
I have a grid using trackModel: { on: true }. The sortIndx is "Name" and the grid can be sorted by any column. The User can make edits in several columns and then use a toolbar button to initiate a ranking function that, if successful, will populate the "Rank" column in all rows with an integer 1-n where n is the number of rows in the grid. An Undo button is available to use "rollback" to rollback the current edits. When ranking is successful, I would like to then sort the grid by the Rank column but not lose the ability to rollback the current edits. Sorting by clicking the Rank column header will do this, but changing sortIndx to "Rank" and using refreshDataAndView (apparently) resets tracking. Is there a way to refresh the grid with a different sort order and preserve tracking? Thanks.
-
There is a sort method which can be used for your case.
It's missing from the docs as it's not multiple column sorting ready yet, would be updated in upcoming version. Since your requirement is to sort single column, it can be used.
$grid.pqGrid('sort', { dataIndx: 'dataIndx of the column', dir: 'up/down' });
http://jsfiddle.net/31ej2crp/
-
This works fine unless the current sortIndx and sortDir are already what I want. In that case using this method results in a toggle in the sort direction regardless of what is specified as "dir (unless I'm missing something). I use this method to sort by another column and then by the column I want, that works. Any other way to resort the grid using the active sortIndx and sortDir (and preserve track changes)? I need to do this because the values in the sortIndx column may have changed. Thanks.
-
Please use the latest version 2.4.1 to use the dir option of sort method.