我在jqgrid中使用以下代码。记录添加成功,编辑和删除选项也正常工作。但我无法验证文本框。我使用了formater选项但事件未被触发。
jQuery("#JQProdTypeGrid").jqGrid({
url: '../handler/JQGridHandler.ashx',
datatype: "json",
width: gwdth,
height: 'auto',
colNames: ['Id', 'Date', 'Mod Date', 'Prod Name', 'Prod Code', 'Model No', 'Min Level', 'Desc', 'Status', 'Created By'],
colModel: [{
name: 'FLD_ID',
index: 'FLD_ID',
width: 20,
stype: 'text'
}, {
name: 'FLD_DATE',
index: 'FLD_DATE',
width: 150,
stype: 'text',
sortable: true,
editable: false
}, {
name: 'FLD_MOD_DATE',
index: 'FLD_MOD_DATE',
width: 60,
hidden: true,
editable: false
}, {
name: 'FLD_PROD_NAME',
index: 'FLD_PROD_NAME',
width: 150,
editable: true,
edittype: "text",
editrules: {
required: true
}
}, {
name: 'FLD_PROD_CODE',
index: 'FLD_PROD_CODE',
width: 120,
editable: true,
edittype: "text",
editrules: {
required: true
}
}, {
name: 'FLD_MODEL_NO',
index: 'FLD_MODEL_NO',
width: 120,
editable: true,
edittype: "text",
editrules: {
required: true
}
}, {
name: 'FLD_MIN_STACK',
index: 'FLD_MIN_STACK',
width: 120,
editable: true,
edittype: "text",
formatter: numFormat,
editrules: {
required: true
}
}, {
name: 'FLD_DESC',
index: 'FLD_DESC',
width: 130,
editable: true,
edittype: "text",
editrules: {
required: true
}
}, {
name: 'FLD_STATUS',
index: 'FLD_STATUS',
width: 100,
height: 30,
editable: true,
edittype: "select",
editrules: {
required: true
},
editoptions: {
value: {
0: 'Active',
1: 'Inactive'
}
}
}, {
name: 'CREATED_BY',
index: 'FLD_CREATED_BY',
width: 130,
sortable: true,
editable: false
}, ],
rowNum: 10,
mtype: 'GET',
loadonce: true,
rowList: [10, 20, 30, 50, 100, 200, 500, 1000000],
pager: '#JQProdTypeGridPager',
sortname: 'FLD_ID',
viewrecords: true,
toppager: true,
sortorder: 'desc',
caption: "Product Type Master",
emptyrecords: "Nothing to display",
editurl: '../handler/JQGridHandler.ashx'
});
function numFormat(cellvalue, options, rowObject) {
alert('enter here');
return cellvalue.replace(".", ",");
}