brasewel
brasewel

Reputation: 73

jqgrid search mvc3

I am trying to search through a list of dates in my jqgrid using the advanced search toolbar with MVC3 as the platform.

I have got the toolbar to display when I click on the search button in the pager by writing

var filters =
{
   "groupOp": "AND",
   "rules": [{ "field": "Date_of_Service", "op": "eq", "data": ""}]
} 

grid3 = $('#BillInformation').jqGrid({
     url: 'CaseInfo/DisplayBillInfoGrid/' + '?caseID=' + caseID,
     ...
     colModel:[
     ...
     { name: 'Date of Service', index: 'Date_of_Service', ... },
     ...
     postData: {
        filters: JSON.stringify(filters)
     },
     ...
});

grid3.navGrid('#pager', { edit: false, add: false, del: false, refresh: false },
        {}, {}, {}, { multipleSearch: true, sFilters: filters }).navButtonAdd('#pager', {
...
});

How do I retrieve the data from the search modal dialog that pops up when I click on the search button. I did look at the Advanced Searching but when I click on the find button my controller doesn't retrieve the search parameters(ie equal, greater than etc) and the value to be searched.

This is my action method in my controller

public ActionResult DisplayBillInfoGrid(string sidx, string sord, int page, 
   int rows, string caseID, string filters)
   {
   ...
   }

Thanks

Upvotes: 0

Views: 1912

Answers (1)

Oleg
Oleg

Reputation: 221997

You don't need to get information from the Advanced Search Dialog manually and sen it manually inside of the postData. jqGrid do already all this for you. Instead of that you can place caseID inside of postData.

I recommend you to download the demo project from the answer or the demo project from the answer. The demos includes the implementation of the advanced searching feature.

Upvotes: 3

Related Questions