My use of the grid involves sorting while having a few rows in inline edit mode.
The questions would be:
-
Is there any way to execute sorting, while inline editing one or more rows?
-
If not, is there an event that will jump when I click the column headers while inline editing one or more rows?(an event where I can maybe remove the editing, before sorting the contents)
Thanks, Catalin
An interesting question! +1 from me.
The problem with sorting of editing rows or cells consists in the access to the contain of the editing cells. The current code of jqGrid don’t do this and so inside of the
clickevent handler on the column headers there are test whether there are any editing line in the grid. If some editing line/lines exist then the sorting will be stopped without to call ofonSortColcallback.So only the second way where one save or restore the editing cells before sorting is possible. To implement this there are one small problem. If one bind additional
clickevent on the column headers it will be called after the previous bound standard handler of jqGrid. So one can’t save or discard the editing changed before the click event will be processed. One can fix the problem in two ways: either one can callsortDatafunction of from the new event handler or one should change the order of bindings to theclickevent. The following code demonstrate the second approach:where
$gridare defined asvar $grid = $("#list"). You can see live how it works on the following demo.