Jquery 定制jqgrid过滤器逻辑

Jquery 定制jqgrid过滤器逻辑,jquery,jqgrid,Jquery,Jqgrid,我使用的是jqgrid版本4.5.2。下面是我的网格定义。在列模型中,我有一个名为region的列,上面有一个过滤器apply jq("#grid").jqGrid({ url:finalUrl, ajaxGridOptions: {cache: false},//added the option to always reload the grid and not to cache the result. datatype: 'json', mtype: 'G

我使用的是jqgrid版本4.5.2。下面是我的网格定义。在列模型中,我有一个名为region的列,上面有一个过滤器apply

jq("#grid").jqGrid({       
 url:finalUrl,   
 ajaxGridOptions: {cache: false},//added the option to always reload the grid and not to cache the result.
 datatype: 'json',    
 mtype: 'GET', 
 colNames:[ 'Requestor Name'],       
 colModel:[
  {name:'requestor',index:'requestor',sortable: true, width:100,editable:false, editrules:{required:true}, editoptions:{size:10}},
  {name:'requestorRegion', index:'requestorRegion',sortable: true,width:65,editable:false, editrules:{required:true}, editoptions:{size:8, style: "height: 90%"}, stype:'select', edittype:'select',"searchoptions": {
          "value": ":All;Asia Pacific:Asia Pacific;Australia/NZ:Australia/NZ;Europe:Europe;Japan:Japan;Latin America:Latin America;North America:North America;CCEMA:CCEMA"
       }}
  ],
   postData: {     
   },    
   height: 'auto',       
   autowidth: true,    
   rownumbers: true,       
   pager: '#pager',       
   viewrecords: true,       
   sortorder: "asc",       
   emptyrecords: "Empty records",      
   loadonce: true,
   rowNum:20,
   ignoreCase: true,
   prmNames: {
       nd: null
   },   
   loadComplete: function() {
    },

   jsonReader : {    
       root: "rows",           
       repeatitems: false,
       page:"page",           
       total: "total",           
       records: "records", 
       cell: "cell",           
       id: "id"      
       }   
   });

 jQuery("#grid").jqGrid('navGrid','#pager',{edit:false,add:false,del:false,search: false, refresh:true})
   .navButtonAdd('#pager',{caption:"Export All",buttonicon:"ui-icon-document",onClickButton: function(){window.open(excelUrl,'_self');},position:"last"});
 jQuery("#grid").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn",ignoreCase: true });
我从过滤器中选择了欧洲区域,网格应该根据欧洲区域过滤记录。 这很好。但现在的要求是,如果选择了europe region,那么我应该在网格中显示包含region europe和CCEMA的所有记录。这可能吗?如果可能的话,如何做到这一点


注意:我使用loadonce=true

在网格中一次性加载数据库中的所有记录,如果我正确理解您的问题,那么您可以尝试组合选项Europe的值,如“Europe,CCEMA:Europe”;因此在服务器端,当您在下拉列表中选择Europe时,您可能会收到“Europe,CCEMA”作为搜索值。然后您可以将这些值与SQL“in”子句一起使用,只需稍加修改

也可以使用逗号(,)以外的字符组合不同的值,但必须在服务器端相应地设置逻辑

试试看它是否有用

e、 g

    {name:'requestorRegion', index:'requestorRegion',sortable: true,width:65,editable:false, editrules:{required:true}, editoptions:{size:8, style: "height: 90%"}, stype:'select', edittype:'select',"searchoptions": {
      "value": ":All;Asia Pacific:Asia Pacific;Australia/NZ:Australia/NZ;Europe,CCEMA:Europe;Japan:Japan;Latin America:Latin America;North America:North America;CCEMA:CCEMA"
   }}