Search All Columns in KendoUI Grid

后端 未结 3 758
谎友^
谎友^ 2020-12-31 04:02

I am trying to create a search box for a kendoUI grid. I have been able to get a start on doing a search based on one field however I would like the value in my search box t

3条回答
  •  爱一瞬间的悲伤
    2020-12-31 04:15

    I think that you should say eq to fee or eq to fi if you want to match one of the two conditions.

    I´ve slightly modified your fiddle to show it. If you type on the search box you will filter records matching either ProductName column or QuantityPerUnit.

    //change event
    $("#category").keyup(function () {
        var val = $('#category').val();
        $("#grid").data("kendoGrid").dataSource.filter({
            logic  : "or",
            filters: [
                {
                    field   : "ProductName",
                    operator: "contains",
                    value   : val
                },
                {
                    field   : "QuantityPerUnit",
                    operator: "contains",
                    value   : val
                }
            ]
        });
    });
    

    IMPORTANT: I have had to update jQuery version to 1.8.2 for making it work and just in case I have updated KendoUI, as well, to the latest version.

提交回复
热议问题