首页 > 解决方案 > Free-jqGrid:根据自定义选择的操作数动态设置搜索输入

问题描述

我正在使用免费的 jqgrid,我使用“customSortOperations:{}”实现了自定义搜索操作数,当我选择一个自定义操作数时,我想将搜索字段输入更改为选择,有没有办法做到这一点?if not is there an event that fires when the operand is chosen to listen for it and implement my custom search field change? 这是我如何使用“customSortOperations:{}”的示例

$.extend($.jgrid.defaults, {
    customSortOperations: {
        tst: {
            operand: "T",
            text: "Test",
        }
    },
});

标签: jqgridfree-jqgrid

解决方案


您只发布了代码的一小段。因此,我不确定我是否完全理解您的问题。要使用新的自定义搜索操作数,您应该在 中定义filter方法并将列定义中customSortOperations.tst的操作包含"tst"在. 如果要将新操作用作默认搜索操作,则该操作应该是数组中的第一个操作。有关更多详细信息,请参见为旧答案创建的例如https://jsfiddle.net/OlegKi/f3gLde6m/2/searchoptions.soptcolModel"tst""tst"searchoptions.sopt


推荐阅读