- jQuery:v1.9.1
- jqgrid:v4.4.4
我已使用通过属性从服务器检索到的数据成功填充了搜索工具栏和表单编辑中的下拉列表,但是高级搜索表单dataUrl
中的同一列不会出现相同的预期列表。
jqgrid
有人可以用v4.4.4确认这个问题吗?我配置错了jqgrid
吗?任何建议都会有所帮助!:-)
在下面的代码中:
searchoptions:{dataUrl:}
在单一/高级搜索中被忽略searchoptions:{dataUrl:}
在搜索工具栏中正确读取editoptions:{dataUrl:}
在编辑表单中正确读取
这是网格配置:
jQuery.extend(jQuery.jgrid.search, {recreateForm: true});
$("#school").jqGrid({
height: 'auto',
url: "lib/CSchoolAjax.php",
datatype: "json",
colNames: ['ID', 'Location'],
colModel: [{
name: 'school_id',
index: 'school_id',
width: 30,
fixed: true,
align: "center",
search:false,
hidden: false
},{
name: 'location',
index: 'location',
width: 80,
align: "center",
editable: true,
edittype: 'select',
editoptions: {
dataUrl: "lib/CSchoolAjaxLocation.php",
sopt: ['eq']
},
stype: "select",
searchoptions: {
dataUrl: "lib/CSchoolAjaxLocation.php",
sopt: ['eq']
}
}
],
sortable: true,
rowNum: 5,
rowList: [5, 10, 20, 30, 40, 50],
autowidth: true,
rownumbers: true,
pager: '#pager_school',
sortname: 'school_id',
viewrecords: true,
sortorder: "desc",
multiselect: false,
caption: "Schools",
editurl: 'lib/CSchoolAjax.php',
hiddengrid:true,
autoencode: true
})
.navGrid('#pager_school', {
edit: true,
add: false,
del: false,
search:true
},{
width: 'auto'
},{},{},{
width: 'auto',
multipleSearch:true,
multipleGroup:false,
//recreateForm: true,
closeOnEscape: true
},{
closeOnEscape:true
})
.jqGrid('navButtonAdd', '#pager_school', {
caption: "",
title: "Select/Reorder Columns",
buttonicon: "ui-icon-calculator",
onClickButton: function () {
$("#school").jqGrid('columnChooser');
}
})
.jqGrid('navButtonAdd', "#pager_school", {
caption: "Search",
title: "Toggle Search Toolbar",
buttonicon: 'ui-icon-search',
onClickButton: function () {
$("#school").filterToolbar({
searchOnEnter: false,
stringResult: true,
defaultSearch: 'cn'
});
}
})
.trigger('reloadGrid');
脚本“CSchoolAjaxLocation.php”返回
<select>
<option value=“1”>Location One</option>
<option value=“2”>Location Two</option>
..
</select>