1

on jqgrid, I want to change criteria to get new records, it means I cannot apply the new query. I did not find the events or functions to do. I just found

jQuery("#sg1").clearGridData(true).trigger("reloadGrid")

Please advice me

sitthykun
  • 87
  • 1
  • 8
  • My solution $('#btnSearch').click(function(){ $('#searchList').setGridParam({url:'/model/actSearch.cfm?'+$('#frmSearch').serialize()}); $('#searchList').trigger("reloadGrid"); }); Found this answer http://stackoverflow.com/questions/1297044/reload-a-loaded-jqgrid-with-a-different-table-data – sitthykun Mar 17 '12 at 08:48
  • Sorry, but your question is difficult to understand. Only from your comment one can suppose that the problem which you have originally come from the implementation which you used. It's better *don't use* `url` which includes parameters directly. Instead of that it's better to use `postData` parameter as function (see [here](http://stackoverflow.com/a/2928819/315935)). In the case every request to the server will include the current values if the form fields. You can use also `$('#frmSearch').serializeArray()` exactly like `$('#frmSearch').seria‌​lize()`. – Oleg Mar 17 '12 at 10:16
  • Thanks and sorry for my article because my explanation not good. I just want to create new button outside and bind to Jqgrid. – sitthykun Mar 19 '12 at 12:25
  • You are welcome! If you would follow [the answer](http://stackoverflow.com/a/2928819/315935) then *all* refreshing of jqGrid like column sorting, paging and so on will send to the server *the current* values from the form. It makes for the user easy the usage of grid and it makes not needed the resetting URL explicitly. The call of `clearGridData` is not needed if you loads the data from the server. – Oleg Mar 19 '12 at 12:32

1 Answers1

0

Hi friend try this,

  $("#jqgrid-id").jqGrid('setGridParam', {postData: { "param1": "somevalue"} }).trigger("reloadGrid");
Lawren Alex
  • 110
  • 5