【发布时间】:2015-06-04 19:41:54
【问题描述】:
我的 jqGrid 中有以下列:
{ name: 'Active',
index: 'Active',
width: '55',
align: 'center',
formatter: 'select',
editable: true,
edittype: "select",
editoptions: { value: { "1": "Yes", "0": "No" }},
stype: 'select',
searchoptions: { value: { "": "All", "1": "Yes", "0": "No" }}
},
问题在于 editoption 值覆盖了 searchoption 值(因此“All”没有在搜索工具栏中显示为选项)。
我使用的是 jqGrid 3.5.3。我不允许更新到更高版本。
如果有帮助,这里是整个表的声明:
mygrid = jQuery("#GridView").jqGrid({
url: 'Handler.ashx',
datatype: "json",
colNames: ['ID', 'Active Flag'],
colModel: [
{ name: 'ID', index: 'ID', width: '45', formatter: 'integer' },
{ name: 'Active', index: 'Active', width: '55', align: 'center', formatter: 'select', editable: true, edittype: "select", editoptions: { value: { "1": "Yes", "0": "No" }}, stype: 'select', searchoptions: { value: { "": "All", "1": "Yes", "0": "No" }} },
],
rowNum: 50,
height: '403px',
rowList: [5, 10, 20, 50, 100],
sortname: 'ID',
pager: jQuery('#PageNavigation'),
sortorder: "asc",
viewrecords: true,
caption: "Tasks",
toolbar: [true, "top"],
editurl: 'Handler.ashx'
我还尝试将 editoptions 和 searchoptions 设置为具有相同的值(All、Yes、No),然后使用 onSelectRow 函数在事后更改 editoptions,就像这样,但它不起作用:
onSelectRow: function (id) {
jQuery('#streamGridView').setColProp('Flag', { editoptions: { value: { "1": "Yes", "0": "No" } });
}
如何解决它,以便我可以有不同的编辑和选择值?
谢谢!
【问题讨论】:
标签: jqgrid