没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|使用教程|编辑:龚雪|2019-11-13 09:47:17.953|阅读 233 次
概述:Kendo UI Filter小部件是一个统一的控件,用于筛选具有数据源的数据绑定组件。使用Kendo UI for jQuery的过滤器,您可以存储其过滤器表达式并为用户恢复其状态。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
Kendo UI目前最新提供Kendo UI for jQuery、Kendo UI for Angular、Kendo UI Support for React和Kendo UI Support for Vue四个控件。Kendo UI for jQuery是创建现代Web应用程序的最完整UI库。
小部件是一个统一的控件,用于筛选具有数据源的数据绑定组件。
使用Kendo UI for jQuery的过滤器,您可以存储其过滤器表达式并为用户恢复其状态。
例如,您只能存储过滤器表达式,并使过滤器能够在用户下次访问页面时应用它。
下面的示例演示如何使用change事件自动应用过滤并保持Filter的最新状态。 重新加载页面后,存储的设置将提供给过滤器配置并应用。
<ol><li>Change the filter.</li><li>Reload the page: <button type="button" onclick="reloadPage();">Reload</button></li><li>The widget will be initialized with the settings that were stored.</li><li>Clear the stored information to start fresh: <button onclick="clearData();">Clear</button></li></ol><div id="filter"></div><ul id="listView"></ul> <script type="text/x-kendo-template" id="item"> <li> <strong>#= name #</strong>, aged #= age #, is on vacation: #= isOnLeave # </li> </script> <script> $(document).ready(function () { var dataSource = new kendo.data.DataSource({ data: [ { name: "Jane Doe", age: "25", isOnLeave: false }, { name: "John Doe", age: "33", isOnLeave: true }, { name: "John Smith", age: "37", isOnLeave: true }, { name: "Nathan Doe", age: 42, isOnLeave: false } ], schema: { model: { fields: { name: { type: "string" }, age: { type: "number" }, isOnLeave: { type: "boolean" } } } } }); $("#filter").kendoFilter({ dataSource: dataSource, change: applyAndStoreFilterExpression, expressionPreview: true, fields: [ { name: "name", type: "string", label: "Name" }, { name: "age", type: "number", label: "Age" }, { name: "isOnLeave", type: "boolean", label: "On Vacation" } ], expression: getInitialExpression() }).data("kendoFilter"); if (getInitialExpression()) { // Apply filter if there was a stored expression. $("#filter").data("kendoFilter").applyFilter(); } $("#listView").kendoListView({ dataSource: dataSource, template: kendo.template($("#item").html()) }); }); function applyAndStoreFilterExpression(e) { e.sender.applyFilter(); // Apply filtering on every change. localStorage["myInitialFilterExpression"] = JSON.stringify(e.expression); // Store the filter expression for future use. } function getInitialExpression() { if (localStorage["myInitialFilterExpression"]) { return JSON.parse(localStorage["myInitialFilterExpression"]); } } function reloadPage() { window.location.reload(); } function clearData() { delete localStorage["myInitialFilterExpression"]; reloadPage(); } </script>
您还可以在发生应用程序逻辑事件时保存并加载筛选器的先前特定状态。
下面的示例演示如何获取当前的过滤器表达式和任何其他设置,并在需要时应用它们。
<ol><li>Change the state of the filter.</li><li>Save the state <button onclick="saveState();">Save</button></li><li>Change the state of the filter again.</li><li>Load the state: <button onclick="loadState();">Load</button></li><li>Clear the state: <button onclick="clearState();">Clear</button></li></ol> <div id="filter"></div> <div id="chart"></div> <script> $(document).ready(function () { var dataSource = new kendo.data.DataSource({ data: [ { price: 25, year: 2017 }, { price: 29, year: 2018 }, { price: 33, year: 2019 } ], schema: { model: { fields: { price: { type: "number" }, year: { type: "number" } } } } }); $("#filter").kendoFilter({ dataSource: dataSource, expressionPreview: true, applyButton: true, fields: [ { name: "price", type: "number", label: "Cost" }, { name: "year", type: "number", label: "Year" } ] }).data("kendoFilter"); $("#chart").kendoChart({ dataSource: dataSource, series: [ { field: "price" } ], categoryAxis: { field: "year" } }); }); function saveState(e) { localStorage["myFilterSettings"] = JSON.stringify(getFilter().getOptions().expression); // You can store and restore all options not just the expression. } function loadState() { if (localStorage["myFilterSettings"]) { var filter = getFilter(); var opts = filter.getOptions(); opts.expression = JSON.parse(localStorage["myFilterSettings"]); filter.setOptions(opts); // If you will restore all options, you need only filter.setOptions(myOptionsLiteral). filter.applyFilter(); // Apply the new filter expression. } } function clearState() { delete localStorage["myFilterSettings"]; } function getFilter() { return $("#filter").data("kendoFilter"); } </script>
扫描关注慧聚IT微信公众号,及时获取最新动态及最新资讯
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@wqylolg.cn
文章转载自:慧都网可视化项目时间线对于有效规划和跟踪至关重要。在本篇博文中,您将学习如何使用 C# 在 Excel 中创建甘特图。只需几行代码,即可自动生成动态、美观的甘特图。
本文将为大家介绍DevExpress XAF如何将.NET Aspire集成到Blazor项目中,欢迎下载最新版组件体验!
在线协同文档编辑器ONLYOFFICE现已支持阿里通义千问( Qwen),带来先进的 AI 功能,实现更智能的文档编辑。本指南将向您展示如何将 Qwen 连接到 ONLYOFFICE,并充分利用其功能。
需要从 PDF 文档中删除特定页面?本快速指南将向您展示如何仅用几行代码删除不需要的页面。
全新升级的Kendo UI,是创建数据丰富的Web应用程序的最完整UI库。
Kendo UI for jQuery完整的jQuery UI组件库,可快速构建出色的高性能响应式Web应用程序。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@wqylolg.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢