0

I have seen lots of questions and answer about this. Not sure what I am doing wrong. I am trying to have a grid filtered when I first display it. I have a filter toolbar, and can successfully filter after it is loaded from user input data. The problem is when trying to filter prior to user input.

grid.jqGrid({
    ...
    colModel: [
       { name: 'someName', label: 'someLabel', index: 'someIndex', width: 110,
         sortable: true, editable: true, edittype: "select", 
         searchoptions: { defaultValue:'Default value' } }
    ...

grid.jqGrid('filterToolbar', { defaultSearch: 'cn', stringResult: true });

the column filter is successfully set to "Default Value". I can go press enter on it, and have the column filtered by it. What can I do to have the grid initialize itself with the filter set?

I know that I can call

grid[0].triggerToolbar();

To have the postdata.filters updated. But, if I do that after setting the toolbar above, it is too late. The query has already been sent to the server. I am sure that I need to do this perhaps in beforeSend?

Thanks, Scott

Stef Heyenrath
  • 9,335
  • 12
  • 66
  • 121
Doo Dah
  • 3,979
  • 13
  • 55
  • 74

1 Answers1

0

The solution here works: jqGrid Filter Toolbar initial default value

Is this the best / only way?

Scott

Community
  • 1
  • 1
Doo Dah
  • 3,979
  • 13
  • 55
  • 74