我正在使用 jqgrid 创建网格。这个有“主要”一个,里面有标题和数据等,还有“高级搜索”。不幸的是,他们都使用相同的 getColModel,我希望在提前搜索时使用不同的标题和 colname。例如我有这样的东西
getColModel: ->
[
{name:'dispId', label: i18n('ProjectList.dispId'), classes:'grid_col', width:6, searchoptions:{sopt:filterOperators.string}, formatter: ((cellvalue, options, rowObject) -> "<a href=\"#{url("/project/#{options.rowId}/view")}\">#{cellvalue}</a>")}
]
并且 i18n('ProjectList.disp') 在预先搜索的列和列名中显示。我的英语真的很糟糕,但我希望你明白我想要做什么 - 我想在主网格和高级搜索选项中有不同的标题,我不想只在我自己的 *.js 脚本中更改 jqgrid 源中的任何内容. (也许 colModel 中的某些属性?找不到想法,我一直在寻找解决方案)\
我相信我称之为“寻呼机”的高级搜索选项
我将此添加到我的 initgrid
afterRedraw: ->
$("#{gridId} select").find("option[value='expectedRealizationDate']").html(i18n('ProjectList.expectedRealizationDate'))
$("#{gridId} select").find("option[value='closing']").html(i18n('ProjectList.closing'))
它有效,但仅当我打开高级搜索时,当我添加新的过滤器标签名称时再次失明