我正在做某事类似于这个问题我有一个复选框列表作为自定义编辑控件。不同之处在于我想从服务器获取我的列表(而不是在客户端上硬编码)检查1、检查2、检查3.
有什么方法可以在列设置或在自定义元素功能?
看来我需要类似的东西dataUrl您用于选择项目的属性,但似乎仅适用于选择项目(不适用于自定义项目)。
有什么建议么?
您可以使用任何list
选项(确切地说editoptions
)在网格初始化期间,然后用从服务器加载的真实数据覆盖该值:
$("#list").jqGrid({
colModel: [
{name:'MyMultiCheck',edittype:'custom',
editoptions:{custom_element:MultiCheckElem,
custom_value:MultiCheckVal,list:''}
}
...
]
...
});
$.ajax({
url:"getMultiCheckList",
// any other parameters like dataType:'json',
// type: 'POST' (default type is 'GET') which depend on the server
success: function(data){
// the code here depend on the format of data returned from the server
// in the simplest situation we have as data already the comma-separated
// string which we need as a value for the list parameter so we can do
jQuery("#list").setColProp('MyMultiCheck',{editoptions:{list:data}});
}
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)