javascript - Need to override Search Filter url param (_search) in jgrid the jquery plugin? -


Hi I have created a user message page with this plugin. The grid user will show inbox and user outbox (sent) messages. Here is a small code:

  jQuery (document) .ready (function () {// .... some stuff currentURL = function () {return 'json_member_mail.php? Task =' + CurrentBox; // Where the current box is either Inbox or Outbox ... // My grid = jQuery stuff ("# list"). JqGrid ({url: currentURL (), datatype: 'Jason', Mtpe: ' GET ', // and even more stuff ....}). JqGrid (' Navigrid ',' # Pager ', {Lill Stuff .... Search: True, // Dialog ...} // Edit dialog Whatever ...); // grid}; // document.  

So when user outbox Something happens:

  JQuery ("#list"). JqGrid ('setGridParam', {url: currentURL (), PostData: {lrt: lastReloadTime}} ) Trigger ("reload grid"); // where the current URL has GET param task = outbox  

All works great unless I use my search filter For example, I search for messages sent from users 'Foo' and it's all good, but when I click on Outbox, it also gives me the user 'Foo' Will try to show the messages sent, but I want to reset the search filter. / P>

I tried to load the search dialog on the document and closed it immediately to get the filter (). Reset and all of that but this does not work: -in-in-search-filter-box

myGrid.trigger ('reload grid');

  .jqGrid ('setGridParam', {url: currentURL}, PostData: {_ search: 'false'}}). Trigger ("reload grid");  

will fix my problem but it will not override the search form

Any generous suggestions?

I do not advise you to use a function call as avalue url < During the grid initialization of the / code> parameter, the value of the parameter will only be caluted once. Instead, you can use

  url: 'json_member_mail.php', postdata: {task: function () {/ * returning box that you have * /}, lrt : LastReloadTime}  

You can also make the property lrt as a code if necessary.

If the postData function is the function will be called on any AJAX request then you can search, paging, sorting or reloading the page CurrentBox of the Actual Real value.

If you need to reload jqGrid, you will not need to change the url or postData and you can simply Triggers ("reload grid") can call only


Comments