请看一下这张图片。 在JQGrid中设置自定义搜索选项
在下拉列表中是搜索选项的集合。我想要的是将这些选项修剪为仅相等而不相等。我不希望显示其他选项。我试图做 但它不起作用。任何帮助赞赏。
navGrid("#pager", {search:true, edit:false,add:false,del:false,searchtext:"Search",refreshtext:"Refresh" },
{sopt: ['eq','ne']}
);
请看一下这张图片。 在JQGrid中设置自定义搜索选项
在下拉列表中是搜索选项的集合。我想要的是将这些选项修剪为仅相等而不相等。我不希望显示其他选项。我试图做 但它不起作用。任何帮助赞赏。
navGrid("#pager", {search:true, edit:false,add:false,del:false,searchtext:"Search",refreshtext:"Refresh" },
{sopt: ['eq','ne']}
);
navGrid("#pager",
{
search:true,
edit:false,
add:false,
del:false,
searchtext:"Search",
refreshtext:"Refresh",
searchoptions:{
sopt: ['eq','ne']
}
});
jQuery("#dataTable").jqGrid('navGrid','#pagingDiv',
{
search:true,
edit:false,
add:false,
del:false
},
{},
{},
{},
{
multipleSearch:false, multipleGroup:false, showQuery: false,
sopt: ['eq', 'ne', 'cn', 'nc', 'bw', 'ew'],
defaultSearch: 'cn'
//optDescriptions: {eq:'my eq', gt:'after', le:'on or before'}
}
);
添加此sopt:['eq','ne']
条件在jqGrid的过滤搜索选项。在jqGrid的
总计可用的搜索选项是
sopt:['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc']
替换下面的代码:
$("#listCountry").jqGrid('navGrid','#pagerDiv',
{edit:false,add:false,del:false},{},{},{},{sopt:['eq','ne']});
脚本:
$(document).ready(function(){
//jqGrid
$("#listCountry").jqGrid({
url:'<%=request.getContextPath()%>/Admin/getCountriesList',
datatype: "json",
colNames:['Edit','Country Code','Country Name','Active'],
colModel:[
{name:'countryId',search:false, index:'countryId', width:30,sortable: false, formatter: editLink},
{name:'countryCode',index:'countryCode', width:100},
{name:'countryName',index:'countryName',width:250},
{name:'isActive',index:'isActive',width:80},
],
rowNum:20,
rowList:[10,20,30,40,50],
rownumbers: true,
pager: '#pagerDiv', headertitles:true,
sortname: 'countryName',
viewrecords: true,
sortorder: "asc",
});
$('#gridContainer div:not(.ui-jqgrid-titlebar)').width("100%");
$('.ui-jqgrid-bdiv').css('height', window.innerHeight * .65);
$('#load_listCountry').width("130");
$("#listCountry").jqGrid('navGrid','#pagerDiv',{edit:false,add:false,del:false},{},{},{},{sopt:['eq','ne']});
$(".inline").colorbox({inline:true, width:"20%"});
});
function editLink(cellValue, options, rowdata, action) {
return "<a href='<%=request.getContextPath()%>/Admin/addCountry/"+ rowdata.countryId + "' title='Edit' class='ui-icon ui-icon-pencil' ></a>";
}
HT ML
<div id="gridContainer">
<table id="listCountry"></table>
<div id="pagerDiv"></div>
</div>
此代码和我已经尝试的唯一区别是使用searchoptions,它添加后,它不能实现我想要的.. –