Jqgrid工具栏过滤,在尝试搜索时无法在字符串''上创建属性'过滤器'
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Jqgrid工具栏过滤,在尝试搜索时无法在字符串''上创建属性'过滤器'相关的知识,希望对你有一定的参考价值。
我正在尝试在jqgrid中过滤电子邮件列的结果。下面是我的代码。当我尝试过滤时,通过screenhot出现如下所述的错误
$(document).ready(function(){
var homeGrid=$('#homeGrid');
homeGrid.jqGrid({
url:'/SpringBootData/departmentEmployees',
mtype:'GET',
colNames:['DeparmentId','DepartmentName','EmployeeId','EmployeeName','EmployeeMail'
,'EmployeeGender','EmployeeDoj','EmployeeType'],
colModel:[{name:'deptId',index:'deptId',hidden:true,editable:true},
{name:'deptName',index:'deptName',editable:true},
{name:'empId',index:'empId',hidden:true,editable:true,},
{name:'empName',index:'empName',editable:true,edittype:'text',search: true},
{name:'empMail',index:'empMail',editable:true,editrules:{email:true,required:true},
search: true,stype:'text',searchoptions: { sopt: ["cn"]}},
{name:'empGender',index:'empGender',editable:true,edittype:'select',
editoptions: {value:{'m':'Male','f':'Female'}},formatter:'select',search: true,stype:'select'},
{name:'empDoj',index:'empDoj',editable:true,edittype:'text'},
{name:'employeeType',index:'employeeType',editable:true,edittype:'select',
editoptions: {value:{1:'Permanent',2:'Contractor'}},formatter:'select'}
],
datatype:'json',
loadonce: true,
gridview:true,
height:'auto',
rownumbers:true,
rowList:[5,10,20],
rowNum:10,
sortable:true,
sortorder:'asc',
search:true,
sortname:'empName',
postData:"",
jsonReader: {
repeatitems: false,
id: "empId",
root: function (obj) { return obj; },
page: function (obj) { return 1; },
total: function (obj) { return 1; },
records: function (obj) { return obj.length; }
},
pager : '#navGrid',
toolbar:[true,'bottom'],
serializeGridData:function(postData){
return JSON.stringify(postData);
},
gridComplete:function(){
$(this).find('tr').find('td[aria-describedby="homeGrid_empDoj"]').each(function(index,obj){
$(this).datepicker({ dateFormat: 'yyyy-mm-dd' });
})
},
onSelectRow:function(rowId){
//console.log(this);
}
}).navGrid('#navGrid',{closeOnEscape:true,del:false,add:false,edit:true,search:true,
edittext:'EditRow',edittitle:'Edit'},{closeOnEscape:true,
navkeys:[true,38,40],
mtype:'PUT',
ajaxEditOptions: { contentType: 'application/json; charset=utf-8', dataType: 'json' },
url:'/SpringBootData/update',
width:'auto',
height:'auto',
closeAfterEdit: true,
serializeEditData:function(postData){
return JSON.stringify(postData);
},
beforeShowForm:function(formId){
$(formId[0]).find('input[name="empDoj"]').datepicker({ dateFormat: 'yy-mm-dd',changeMonth: true, changeYear: true, yearRange: '1989:2020' });
},
beforeSubmit:function(postData){
console.log(postData);
return[true ,"sending to updated"];
},
afterSubmit:function(response,postData){
if(response.responseJSON.deptId>0){
homeGrid.jqGrid('setGridParam',{datatype:'json'}).trigger("reloadGrid");
}
}
},{},{},{multipleSearch : true},{});
homeGrid.jqGrid('filterToolbar',{searchOnEnter:false});
})
下面是尖叫声
我在jqgrid.src文件中出现错误,如下所示
有人可以帮我这个忙吗?我无法对列进行过滤
答案
代替我们支持商业Guriddo jqGrid,您的问题可能会因为postData参数不能为字符串而出现。它应该是对象。
为了使它起作用,您可能需要在网格选项中注释postData:“”或将其设置为这样的对象
homeGrid.jqGrid({
...
postData:{},
...
});
以上是关于Jqgrid工具栏过滤,在尝试搜索时无法在字符串''上创建属性'过滤器'的主要内容,如果未能解决你的问题,请参考以下文章
jqGrid 工具栏搜索仅适用于前 20 行。分页为 20,40,60