0
  • 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”&gt;Location One</option>
<option value=“2”&gt;Location Two</option>
..
</select>
4

1 回答 1

0

单字段和高级搜索ajaxSelectOptions需要明确定义该属性。

于 2013-02-20T10:26:19.000 回答