2013-06-21 149 views
0

搜索功能无法正常工作。当在控制器参数中看起来像“_search = true”,“searchField = null”,“searchString = null”,“searchOper = null”,这里我没有获得searchField,searchString,searchOper的值。请任何人帮忙。问题搜索

如果我给loadonce:true property then search is working。但我只获得第一页记录。我没有收到其他页面记录。我怎样才能解决这个问题。

我的代码:

$(function() { 

     $("#Channelslistgrid").jqGrid({ 
      colNames: ['ChannelName', 'Description', 'status'], 
      colModel: [ 
         { name: 'ChannelName', index: 'ChannelName', sortable: true, align: 'left', width: '200', 
          editable: false, edittype: 'text',search:true 

         }, 
         { name: 'Description', index: 'Description', sortable: false, align: 'left', width: '120', 
          editable: false, edittype: 'text',search:true 

         }, 


         { name: 'status', index: 'status', sortable: false, align: 'left', width: '220', 
          editable: false, edittype: 'text',search:true 
         }, 
        ], 
      pager: jQuery('#pager'), 
      sortname: 'Title', 
      rowNum: 15, 
      rowList: [15, 20, 25], 
      sortorder: "desc", 
      height: 345, 
      ignoreCase: true, 
      viewrecords: true, 
      rownumbers: true, 
      caption: 'Channels List', 
      width: 660, 
      url: "@Url.Content("~/Home/Channelslist")", 
      datatype: 'json', 
      mtype: 'GET', 
      loadonce: true 

     }) 
     jQuery("#Channelslistgrid").jqGrid('filterToolbar', { searchOnEnter: true, enableClear: false }); 

    }); 

控制器

public ActionResult Channelslist(int page, int rows, string sidx, string sord, bool _search, string searchField, string searchString, string searchOper) 
     { 
//code 
} 

回答

0

相反,你可以使用下面的控制器代码以获得上键入filtertoolbar搜索参数。

public ActionResult Channelslist(int page, int rows, string sidx, string sord, bool _search) { 
    string ChannelName= ""; 
    string desc= ""; 
    if (Request.Params["ChannelName"] != null) ChannelName = Request.Params["ChannelName"]; 
    if (Request.Params["Description "] != null) desc= Request.Params["Description"]; 
    }