编辑内联时如何在选择类型jqgrid中使用serach框

时间:2017-11-10 05:39:00

标签: jquery jqgrid free-jqgrid

15.1 我在jqGrid中使用select。我需要能够搜索到选择。 这个演示:       https://jsfiddle.net/dnfk8hmr/95/

colModel: [
    { name: "act", template: "actions" },
    { name: "id", width: 50 },
    { name: "PackageCode", width: 110 , editable: true },
    { name: "Name", width: 200, editable: true },
    { name: "d", width: 100, editable: true ,edittype: 'select',
      editoptions: { value: 'FE:FedEx;TN:TNT;IN:Intim;FE2:FedEx2;TN2:TNT2;IN2:Intim2'}
    },
],

我认为使用dataInit:function(el){} jqGrid

2 个答案:

答案 0 :(得分:0)

首先,您在输入数据和d:"FE"中使用editoptions: { value: 'FE:FedEx;TN:TNT;IN:Intim;FE2:FedEx2;TN2:TNT2;IN2:Intim2' }。然后你可能想要显示" FE"为"FedEx"。因此,您必须添加formatter: "select"

关于搜索问题。默认情况下,过滤器工具栏使用所有字段的输入元素。如果您需要使用其他类型的搜索,则应添加stypesearchoptions,其中描述了所有搜索属性

例如,修改后的演示https://jsfiddle.net/dnfk8hmr/97/使用

{
    name: "d", width: 100, editable: true,
    formatter: "select",
    edittype: 'select',
    editoptions: {
        value: 'FE:FedEx;TN:TNT;IN:Intim;FE2:FedEx2;TN2:TNT2;IN2:Intim2'
    },
    stype: 'select',
    searchoptions: {
        sopt: ["eq", "ne"],
        noFilterText: "Any"
    }
}

答案 1 :(得分:0)

我希望Able能够搜索combox。这个解决方案

   dataInit: function (domElem) {
            $(domElem).addClass("js-example-basic-single");
           $('.js-example-basic-single').select2();
                                    }

please see demo