jqgrid editoptions:必需不起作用 [英] jqgrid editoptions: required not functioning
本文介绍了jqgrid editoptions:必需不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好,不知道我在这里做错了什么:
ok not sure what i'm doing wrong here:
$("#list").jqGrid({
url: --URL--,
datatype: 'json',
mtype: 'GET',
colModel: [
{ label: 'Index', index: 'Index', key: true, hidden: true },
{ label: 'SampleSize', index: 'SampleSize', editable: true, editrules: { required: true, number: true} },
],
pager: '#pager',
rowNum: 10,
rowList: [10, 20, 30],
viewrecords: true,
height: 'auto',
width: 'auto',
editurl: '.',
createurl: '.',
deleteurl: '.'
});
$('#list').jqGrid('navGrid', '#pager',
{ edit: true, add: true, del: true, search: false },
{ url: '#' }, // edit options
{url: '#' }, // add options
{url: '#' }, // delete options
{}, // search options
{}
);
在编辑/创建记录时,我可以将"samplesize"的文本框保留为空,并且jqgrid不会引发任何类型的错误.我忘了添加一些东西吗?
when editing / creating a record, i can keep the textbox for 'samplesize' empty and jqgrid does not throw any kind of error. am i forgetting to add something in?
推荐答案
确定发现了问题-我在colModel中没有'name'参数:
ok found out the problem - i didn't have the 'name' parameter in the colModel:
$("#list").jqGrid({
url: --URL--,
datatype: 'json',
mtype: 'GET',
colModel: [
{ label: 'Index', index: 'Index', key: true, hidden: true },
{ name: 'SampleSize', label: 'SampleSize', index: 'SampleSize', editable: true, editrules: { required: true, number: true}
知道如何即可轻松修复...
easy fix when you know how...
这篇关于jqgrid editoptions:必需不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文