【问题标题】:How to filter a Kendo UI MVC grid using a clienttemplate field如何使用客户端模板字段过滤 Kendo UI MVC 网格
【发布时间】:2016-05-18 05:59:54
【问题描述】:

我有一个剑道 ui 网格和一个字段,如下所示: columns.Bound(c => c.ProjectManagerId).ClientTemplate("#:ProjectManagerName#").Title("Project Manager").Filterable(p => p.*UserAnotherFieldHere*("ProjectManagerName")); 我正在显示 projectManagerName,但该字段是 Id。如何根据名称字段进行排序和过滤?

【问题讨论】:

    标签: kendo-ui grid


    【解决方案1】:

    如果您使用的是客户端 sied 过滤,那么您可以使用自定义过滤运算符

    dataSource.filter({
        field: "FieldName",
        operator: function(item, value){
            //implement your logic
        },
        value: 
    })
    

    对于排序:

    { field: "id", title: "id" },
            { 
                field: "FieldName", 
                title: "FieldNameTitle",
                sortable: {
                    compare: function (a, b) {
                        return implement your logic here
                    }
                }
            }
    

    【讨论】:

    • 我正在使用 MVC 和 JSON 数据绑定。我可以使用任何东西作为 Request Json 调用的设置吗?
    • 您可以使用服务器端过滤、排序和分页。您可以使用参数映射将网格选项(过滤、排序和分页)传递给服务器,然后您可以在那里实现您的自定义逻辑。
    猜你喜欢
    • 1970-01-01
    • 2019-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-23
    相关资源
    最近更新 更多