在 jqgrid 的工具栏过滤器字段中使用下拉菜单删除列值

using drop-downs in the toolbar filter fields in jqgrid removes column values

我在 this 问题中使用了信息,我将提到的属性直接放在字段属性中,而不是通过这样的函数:

{
    name:'A_ORG_SECTOR',
    index:'A_ORG_SECTOR',
    align: 'left',
    width:80,
    sortable:true,
    search:true,
    stype:'select',
    editable:false,
    cellEdit: false ,
    formatter:'select',
    searchoptions: {
        sopt:['eq'],
        value: ':All;1:IT;2:Strategy'
    }
},

...下拉列表显示正确,但列值现在已清除@加载中的附件图像...有帮助吗???

jquery 版本:1.9.1

jqGrid 版本:4.5.0

关于 fork,我不确定,它实际上是 liferay 库的一部分,但似乎是免费版本。

在将搜索转换为 select 而不是文本

之前,这些值已正确显示

我想你的主要原因可能是遗漏了 editoptions.value(或者在使用免费 jqGrid 分支的情况下可能是 formatoptions.value)(参见 the old documentation):

{
    name:'A_ORG_SECTOR',
    width:80,
    formatter:'select',
    editoptions: { value: '1:IT;2:Strategy' },
    stype:'select',
    searchoptions: {
        sopt:['eq'],
        value: ':All;1:IT;2:Strategy'
    }
},

此外,您应该验证用于填充网格的输入数据是否包含 12 之类的值,而不是文本 ITStrategy

jqGrid 的确切行为可能在很大程度上取决于您使用的 jqGrid 版本以及来自 jqGrid 的分支。请插入有关您使用的 jqGrid version/fork 的更多完整信息。