Sorting and filters

I have several filters which can be activated by clicking buttons outside the grid. When I sort the grid’s rows and switch between filters, sorting gets lost and returns to the initial sorting order. How to remain sorting order through filtering?

Sorting applied in filtered state will be lost after unfiltering of grid.The only way to prevent changes is to save sorting state before filtering and reapply it after filter applied


var state = grid.getSortingState(); //get sorting state
grid.filterBy(…
grid.sortRows(state[0],null,state[1]); //restore sorting