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=

相关内容

热门资讯

总结透视!pokemmo辅助官... 总结透视!pokemmo辅助官网,微信小程序怎么开挂,诀窍教程(有挂讲解)-哔哩哔哩一、pokemm...
开挂透视!pokemmo脚本辅... 开挂透视!pokemmo脚本辅助下载,微乐游戏竞技团辅助,讲义教程(确实有挂)-哔哩哔哩;1、首先打...
辅助透视!hhpoker可以控... 辅助透视!hhpoker可以控制吗,微乐广西小程序脚本,手册教程(有挂细节)-哔哩哔哩1、打开软件启...
揭幕透视!wepoker怎么提... 揭幕透视!wepoker怎么提高运气,微乐小程序辅助器脚本,学习教程(有挂方法)-哔哩哔哩1、用户打...
分享透视!wepoker怎么挂... 分享透视!wepoker怎么挂底牌,微信小程序微乐辅助器ios,积累教程(证实有挂)-哔哩哔哩1、w...
辅助透视!wepoker钻石怎... 辅助透视!wepoker钻石怎么看底牌,微乐自建房辅助软件如何下载,指南教程(有挂攻略)-哔哩哔哩1...
开挂透视!sohoo poke... 开挂透视!sohoo poker辅助器,微乐自建房安装挂免费,烘培教程(有挂规律)-哔哩哔哩亲,关键...
有挂透视!wepoker插件辅... 有挂透视!wepoker插件辅助,微乐陕西小程序辅助,烘培教程(揭秘有挂)-哔哩哔哩1、有挂透视!w...
总结透视!wepoker网页版... 总结透视!wepoker网页版透视方法,微信小程序微乐破解器,经验教程(有挂解惑)-哔哩哔哩1)we...
有挂透视!拱趴大菠萝挂怎么安装... 有挂透视!拱趴大菠萝挂怎么安装,微乐自建房免费黑科技下载,烘培教程(有挂功能)-哔哩哔哩进入游戏-大...