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=

相关内容

热门资讯

透视举措!wepoker软件安... 透视举措!wepoker软件安装包(WePoKer简单)都是存在有辅助攻略(哔哩哔哩)所有人都在同一...
透视举措!hh poker软件... 透视举措!hh poker软件(德扑之心透视)真是真的有辅助神器(哔哩哔哩)1、很好的工具软件,可以...
透视项目!wepoker买脚本... 您好,wepoker买脚本靠谱吗这款游戏可以开挂的,确实是有挂的,需要了解加去威信【48527505...
透视指南!wepoker透视有... 透视指南!wepoker透视有用吗(WePoKer方法)都是真的有辅助软件(哔哩哔哩)1、玩家可以在...
透视操作!wepoker手机助... 透视操作!wepoker手机助手(HHpoker有用)一贯真的有辅助技巧(哔哩哔哩)1、游戏颠覆性的...
透视教材!aapoker ai... 透视教材!aapoker ai插件(WePoKer书签)一直有辅助攻略(哔哩哔哩)进入游戏-大厅左侧...
透视绝活!购买的wpk辅助在哪... 透视绝活!购买的wpk辅助在哪里下载(WePoKer用挂)总是真的有辅助工具(哔哩哔哩)1、这是跨平...
透视学习!hhpoker免费透... 透视学习!hhpoker免费透视脚本(HHpoker模拟器)一直是真的有辅助攻略(哔哩哔哩)1、hh...
透视绝活儿!wepoker怎么... 透视绝活儿!wepoker怎么挂底牌(WePoKer辅助)一贯真的有辅助软件(哔哩哔哩)1、上手简单...
透视烘培!wepoker祈福有... 透视烘培!wepoker祈福有用吗(HHpoker辅助)本来真的有辅助教程(哔哩哔哩)1)wepok...