Jqgrid 无法获取属性';stype&x27;指未定义的或空的引用
我正在使用jqgrid filtertoolbar。我有4个选择过滤器。当我试图在任何Jqgrid 无法获取属性';stype&x27;指未定义的或空的引用,jqgrid,Jqgrid,我正在使用jqgrid filtertoolbar。我有4个选择过滤器。当我试图在任何select框中选择一个值时,我得到了以下错误 Unable to get property 'stype' of undefined or null reference 在我的代码中是否存在任何常规错误或缺少的值 //代码: colModel的示例: colModel: jQuery.ajax({ url: 'ManageCandidateDetails.aspx/GetAllCandid
select
框中选择一个值时,我得到了以下错误
Unable to get property 'stype' of undefined or null reference
在我的代码中是否存在任何常规错误或缺少的值
//代码:
colModel的示例:
colModel:
jQuery.ajax({
url: 'ManageCandidateDetails.aspx/GetAllCandidateDetails',
type: "POST",
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (data) {
// debugger;
genericResult = $.parseJSON(data.d);
// debugger;
jQuery("#CandidateDetailsGrid").jqGrid({
data: genericResult.candidateDetails,
datatype: "local",
// colNames: ['CandidateId', 'Email', 'Name'],
//colModel: [{ name: 'CandidateId', index: 'CandidateId', width: 75}, { name: 'Email', index: 'Email', width: 75 }, { name: 'Name', index: 'Name', width: 100}],
colNames: ['CandidateId', 'Name', 'Email', 'DOB', 'Gender', 'Qualification', 'Department', 'OtherQual', 'OtherDept', 'Exp(Years)', 'Exp(Months)', 'Mobile', 'Country', 'State', 'City', 'ZipCode', 'FilePath', 'Sel.Status', 'CreatedDate', 'ModifiedDate', 'ModifiedBy', 'Status', 'LastLoginTime'],
colModel: [{ name: 'CandidateId', index: 'CandidateId', width: 75, editable: true },
{ name: 'Name', index: 'Name', width: 100, editable: true },
{ name: 'Email', index: 'Email', width: 75, editable: true },
{ name: 'DOB', index: 'DOB', width: 50, editable: true, searchoptions: { dataInit: newDatePick }, editoptions: { dataInit: newDatePick} },
{ name: 'Gender', index: 'Gender', width: 50, editable: true },
{ name: 'Qualification', index: 'Qualification', width: 75, editable: true, stype: 'select', editoptions: { value: ":All;" + genericResult.qualification} },
{ name: 'Department', index: 'Department', width: 75, editable: true, stype: 'select', editoptions: { value: ":All;" + genericResult.department} },
{ name: 'OtherQual', index: 'OtherQual', width: 75, editable: true },
{ name: 'OtherDept', index: 'OtherDept', width: 75, editable: true },
{ name: 'ExperienceYears', index: 'ExperienceYears', width: 75, editable: true },
{ name: 'ExperienceMonths', index: 'ExperienceMonths', width: 75, editable: true },
{ name: 'Mobile', index: 'Mobile', width: 100, editable: true },
{ name: 'Country', index: 'Country', width: 100, editable: true, stype: 'select', formatter: 'select', edittype: 'select',
searchoptions: {
value: allCountries, stype: 'select'
},
editoptions: {
value: allCountries,
dataInit: removeTheOptionAll,
dataEvents: [
{ type: "change", fn: function (e) { changeStateSelect($(e.target).val(), e.target); } }
]
}
},
{ name: 'state', index: 'state', width: 100, formatter: "select", stype: "select",
editable: true, edittype: "select",
editoptions: { value: allStates, dataInit: removeTheOptionAll },
searchoptions: { value: allStates }
},
{ name: 'City', index: 'City', width: 50, editable: true },
{ name: 'ZipCode', index: 'ZipCode', width: 50, editable: true },
{ name: 'FilePath', formatter: function () { return "<img src='../Images/error.png' alt='my image' />"; }, unformat: imageUnFormat, index: 'FilePath', width: 50 },
{ name: 'SelectedStatus', index: 'SelectedStatus', width: 75, edittype: 'checkbox', formatter: 'checkbox', editable: true, editoptions: { value: "1:Yes;0:No" }, stype: 'select', searchoptions: { sopt: ['eq'], value: "All:All;1:Yes;0:No"} },
{ name: 'CreatedDate', index: 'CreatedDate', width: 75, formatoptions: { srcformat: "ISO8601Long", newformat: "d/m/Y h:i A" },
searchoptions: { dataInit: datePick }, editoptions: { dataInit: datePick }
},
{ name: 'ModifiedDate', index: 'ModifiedDate', width: 75, formatoptions: { srcformat: "ISO8601Long", newformat: "d/m/Y h:i A" },
searchoptions: { dataInit: datePick }, editoptions: { dataInit: datePick }
},
{ name: 'Modifiedby', index: 'ModifiedBy', width: 75 },
{ name: 'Status', index: 'Status', width: 50, edittype: 'checkbox', editable: true, stype: 'select', searchoptions: { value: "All:All;1:Yes;2:No"} },
{ name: 'LastLoginTime', index: 'LastLoginTime', width: 75, formatoptions: { srcformat: "ISO8601Long", newformat: "d/m/Y h:i A" },
searchoptions: { dataInit: datePick, attr: { title: 'Select Date'} }, editoptions: { dataInit: datePick }
}],
rowNum: 10,
mtype: 'GET',
loadonce: true,
rowList: [10, 20, 30],
pager: '#CandidateDetailsGridPager',
sortname: 'CandidateId',
viewrecords: true,
caption: "Candidate Details",
ignoreCase: true,
gridview: true,
rownumbers: true
});
jQuery("#CandidateDetailsGrid").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" });
$('#CandidateDetailsGrid').jqGrid('navGrid', '#CandidateDetailsGridPager',
{
edit: true,
add: true,
del: true,
search: true,
searchtext: "Search",
addtext: "Add",
edittext: "Edit",
deltext: "Delete"
},
{ // edit option
beforeShowForm: function (form) {
}
},
{ // add option
addcaption: 'Add Candidate Detail',
beforeShowForm: function (form) {
//debugger;
$("#myFormError").remove();
$('#tr_LastLoginTime', form).hide();
$('#tr_CandidateId', form).hide();
$('#tr_Modifiedby', form).hide();
$('#tr_ModifiedDate', form).hide();
$('#tr_CreatedDate', form).hide();
},
onclickSubmit: function (response, postData) {
debugger;
$("#FormError").text("");
$("<tr id='myFormError'><td colspan='2'><div style='background-color:green;color:white; font-weight:bold; width:100%;padding-left:5px;'>Success</div></td></tr>").insertAfter("#FormError");
}
}
);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Request: " + XMLHttpRequest.toString() + "\n\nStatus: " + textStatus + "\n\nError: " + errorThrown);
}
});
//Unformat the image during the edit.
function imageUnFormat(cellvalue, options, cell) {
return cellvalue
}
jQuery.ajax({
url:'ManageCandidateDetails.aspx/GetAllCandidateDetails',
类型:“POST”,
数据类型:“json”,
contentType:“应用程序/json;字符集=utf-8”,
成功:功能(数据){
//调试器;
genericResult=$.parseJSON(data.d);
//调试器;
jQuery(“#候选etailsgrid”).jqGrid({
数据:genericResult.candidateDetails,
数据类型:“本地”,
//colNames:['CandidateId','Email','Name'],
//colModel:[{name:'CandidateId',index:'CandidateId',width:75},{name:'Email',index:'Email',width:75},{name:'name',index:'name',width:100}],
colNames:['CandidateId'、'Name'、'Email'、'DOB'、'Gender'、'quality'、'Department'、'OtherQual'、'OtherDept'、'Exp(Years)'、'Exp(Months)'、'Mobile'、'Country'、'State'、'ZipCode'、'FilePath'、'Sel.Status'、'CreatedDate'、'ModifiedDate'、'modified,
colModel:[{name:'CandidateId',index:'CandidateId',宽度:75,可编辑:true},
{name:'name',index:'name',宽度:100,可编辑:true},
{name:'Email',index:'Email',宽度:75,可编辑:true},
{name:'DOB',index:'DOB',宽度:50,可编辑:true,searchoptions:{dataInit:newDatePick},editoptions:{dataInit:newDatePick},
{name:'Gender',index:'Gender',宽度:50,可编辑:true},
{name:'Qualification',index:'Qualification',width:75,editable:true,stype:'select',editoptions:{value::All;“+genericResult.Qualification},
{name:'Department',index:'Department',width:75,editable:true,stype:'select',editoptions:{value:'All;“+genericResult.Department},
{name:'OtherQual',index:'OtherQual',宽度:75,可编辑:true},
{name:'OtherDept',index:'OtherDept',宽度:75,可编辑:true},
{name:'ExperienceYears',index:'ExperienceYears',宽度:75,可编辑:true},
{name:'ExperienceMonths',index:'ExperienceMonths',宽度:75,可编辑:true},
{name:'Mobile',index:'Mobile',宽度:100,可编辑:true},
{name:'Country',index:'Country',width:100,editable:true,stype:'select',formatter:'select',edittype:'select',
搜索选项:{
值:所有国家/地区,样式:“选择”
},
编辑选项:{
价值观:所有国家,
dataInit:删除可选的,
数据事件:[
{type:“change”,fn:function(e){changeStateSelect($(e.target).val(),e.target);}
]
}
},
{名称:'state',索引:'state',宽度:100,格式化程序:“select”,stype:“select”,
可编辑:true,编辑类型:“选择”,
编辑选项:{value:allStates,dataInit:removeTheOptionAll},
搜索选项:{value:allStates}
},
{name:'City',index:'City',宽度:50,可编辑:true},
{name:'ZipCode',index:'ZipCode',宽度:50,可编辑:true},
{name:'FilePath',格式化程序:函数(){return”“;},未格式化:imageUnFormat,索引:'FilePath',宽度:50},
{name:'SelectedStatus',index:'SelectedStatus',width:75,edittype:'checkbox',formatter:'checkbox',edit:true,editoptions:{value:'1:Yes;0:No'},stype:'select',searchoptions:{sopt:['eq'],value:'All:All;1:Yes;0:No'},
{name:'CreatedDate',index:'CreatedDate',宽度:75,格式选项:{srcformat:'ISO8601Long',newformat:'d/m/Y h:i A'},
搜索选项:{dataInit:datePick},编辑选项:{dataInit:datePick}
},
{name:'ModifiedDate',index:'ModifiedDate',宽度:75,格式选项:{srcformat:'ISO8601Long',newformat:'d/m/Y h:i A'},
搜索选项:{dataInit:datePick},编辑选项:{dataInit:datePick}
},
{name:'Modifiedby',index:'Modifiedby',宽度:75},
{name:'Status',index:'Status',width:50,edittype:'checkbox',edit:true,stype:'select',searchoptions:{value:'All:All;1:Yes;2:No'},
{名称:'LastLoginTime',索引:'LastLoginTime',宽度:75,格式选项:{srcformat:'ISO8601Long',新格式:“d/m/Y h:i A”},
搜索选项:{dataInit:datePick,attr:{title:'Select Date'}},editoptions:{dataInit:datePick}
}],
rowNum:10,
mtype:'获取',
有一次:是的,
行列表:[10,20,30],
传呼机:“#候选传呼机”,
sortname:“候选身份”,
viewrecords:是的,
描述:“候选人详细信息”,
点火