问题
With TreeGrid enabled in jqGrid, how can one create a work-around or customize the jqGrid source code so that the filter toolbar works properly on the client side?
Out of the box, having TreeGrid enabled disables client-side filtering, paging, and client-side sorting. I was able to make simply adjustments to the jqGrid source code to solve the latter two issues.
回答1:
The main problem with filtering of tree grid is just it's not clear what should be displayed as the result of filtering. I try to explain it on an example. Let us we have a tree with
+root
+testchild1
test1
+child2
test2
and you filter for the word "test". What should be displayed? Should be displayed the tree below?
+testchild1
test1
test2
or the original tree stay be unfiltered?
If you do know exactly want should be displayed in the grid after the filtering you can implement the hiding of the unneeded rows manually. You can use beforeSearch callback. You can modify the code from the answer for example.
来源:https://stackoverflow.com/questions/9397657/enable-client-side-filtering-in-jqgrids-treegrid