1

I've got a filter toolbar in my grid where I set some default values and after the filters are set I run the following code to refresh the content of the grid.

var gridDOM = this; // save $("#list")[0] in a variable
if ($(this).jqGrid('getGridParam', 'datatype') === 'json') {
  // the first load from the server
  setTimeout(function () {
    gridDOM.triggerToolbar();
  });
}

The problem with this is that the grid is loaded with all the data first, without any filters applied. This is producing a small "flash" when the filters are applied with the above code.

What I want is to load the result of the filtering directly, and not with preloading the full content, and then present the filtered result.

Sebastian Zartner
  • 18,808
  • 10
  • 90
  • 132
ffffff01
  • 5,068
  • 11
  • 52
  • 61

1 Answers1

2

I think that the origin of the problem which you has is outside of the code which you posted. If you need to load the filtered grid directly as the initialization you should just set filters property of the postData option and set search option of jqGrid to true.

See the demo from the answer for more information.

If you want additionally to sill the filter toolbar with the information from the postData.filters you can call refreshSerchingToolbar function which I described in the answer.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798