AngularUI-Kendo-动态列下的筛选器未工作
创始人
2024-10-29 20:30:25
0

处理动态列时,需要在Kendo Grid初始化前准备好列数据,并在数据模型中添加列字段。此外,在列数组中添加对象时,需要设置标题、字段、筛选器和模板等属性。例如,以下是处理筛选器的示例代码:

$scope.gridOptions = {
    dataSource: {
        type: "odata",
        data: products,
        pageSize: 20
    },
    filterable: true,
    sort: { field: "ProductName", dir: "asc" },
    pageable: true,
    columns: [
        { field:"ProductName", title: "Product Name" },
        { field:"UnitPrice", title:"Unit Price", filterable: { ui: rangeSliderFilterTemplate } },
        { field:"UnitsInStock", title:"Units In Stock", filterable: true },
        { field:"Discontinued", title:"Discontinued", filterable: true }
    ]
};

function rangeSliderFilterTemplate(element) {
    element.kendoRangeSlider({
        min: 0,
        max: 200,
        step: 1,
        change: function() {
            grid.dataSource.filter({
                field: "UnitPrice", operator: "gte", value: this.values()[0]
            });
            grid.dataSource.filter({
                field: "UnitPrice", operator: "lte", value: this.values()[1]
            });
        }
    });
}

在以上示例中,我们为单位价格列添加了筛选器模板。使用kendoRangeSlider插件为滑块创建了一个模板,并在模板中使用值来筛选数据源。

同时,动态列通常需要一些逻辑来处理数据。我们可以使用ng-grid和ui-grid插件来实现完善的动态列功能。例如,在ui-grid中,我们可以将数据模型绑定到$scope.gridOptions,然后在适当的时候调用setVisible方法来切换列。具体的代码示例可以参考以下链接:

https://plnkr.co/edit/nUdRtTtYtvInyKaB?p=

相关内容

热门资讯

透视指引!werplan透视挂... 透视指引!werplan透视挂(透视)总是真的有辅助软件(哔哩哔哩)1、完成werplan透视挂辅助...
透视经验!htx矩阵wepok... 透视经验!htx矩阵wepoker辅助(透视)确实存在有辅助插件(哔哩哔哩)1、htx矩阵wepok...
透视讲义!hhpoker德州挂... 透视讲义!hhpoker德州挂真的有吗(透视)好像是真的辅助插件(哔哩哔哩)1)hhpoker德州挂...
透视指南!拱趴大菠萝自动计算机... 透视指南!拱趴大菠萝自动计算机器人(透视)确实存在有辅助神器(哔哩哔哩)1、下载好拱趴大菠萝自动计算...
透视妙招!佛手在线大菠萝为什么... 透视妙招!佛手在线大菠萝为什么都输(透视)确实有辅助工具(哔哩哔哩)1)佛手在线大菠萝为什么都输辅助...
透视秘籍!pokerworld... 透视秘籍!pokerworld软件(透视)确实是真的辅助app(哔哩哔哩)小薇(辅助器软件下载)致您...
透视教材!德州之星扫描器(透视... 透视教材!德州之星扫描器(透视)好像是真的辅助插件(哔哩哔哩)1、任何德州之星扫描器透视是真的假的的...
透视模块!wepoker怎么拿... 透视模块!wepoker怎么拿到好牌(透视)好像有辅助修改器(哔哩哔哩)1、下载好wepoker怎么...
透视诀窍!德普之星私人局辅助免... 透视诀窍!德普之星私人局辅助免费(透视)一贯存在有辅助插件(哔哩哔哩)所有人都在同一条线上,像星星一...
透视学习!wepoker手机版... 透视学习!wepoker手机版透视脚本(透视)好像是真的辅助工具(哔哩哔哩)1、每一步都需要思考,不...