Surbhi
Surbhi

Reputation: 1

Preset the jqGrid filter text box through code

We are using jqGrid for ASP.Net version 3.6.6.0. We are facing a problem in search/filter as described below:

  1. We have created a jqGrid using ASP.Net (C#) having column likes Name ,Status etc. There is a hyperlink on Name column.
  2. We are able to successfully populate the grid
  3. User applies search on a column say “Name=’XYZ’” and grid is updated according to search results.
  4. User clicks on Name link and is taken to details page of that Name.
  5. Now when user clicks back from that details page ,search is lost.
  6. We were able to persist the searched grid details using session however we are not able to set the searched text back in search text box. i.e we are not able to set the value “XYZ” in search text box of Name Column.

Need your help in knowing which property or method is to be used to set the Filter text box through code.

Upvotes: 0

Views: 2162

Answers (1)

Oleg
Oleg

Reputation: 221997

If you use Advanced Searching the searching parameters are saved in the postData.filters property in the JSON encoded format. If you use the Single field searching another properties of the postData parameter of the jqGrid save the filter information: searchField, searchString, searchOper. So what you can to do is to same the filters in the cookie. To restore the searching filters you can examine the cookie and if needed extend the postData parameter with the corresponding properties (see here for details).

If you want that the searching filters will be not only displayed if one opens the Searching Dialog you can set additionally the search:true parameter of the jqGrid.

I recommend you additionally read the answer on the close question.

Upvotes: 1

Related Questions