本文介绍了Kendo Angular 2网格过滤器类似于Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用kendo-angular在网格上实现类似于excel的过滤.我在文档中找不到解决方案.

How can We implement an excel-like filtering on a grid using kendo-angular. I can't find a solution in the documentation.

这是JQuery版本中的功能: http://demos.telerik.com/kendo-ui/spreadsheet/sorting-过滤

This is the feature in JQuery version:http://demos.telerik.com/kendo-ui/spreadsheet/sorting-filtering

类似于此过滤器

推荐答案

下面是一个示例:(在其中的过滤器菜单"选项中.遵循倒数第二个示例)

Here is an example: (In Filter Menu option inside it. Follow second-last example)

https://www.telerik. com/kendo-angular-ui/components/grid/filtering/reusable-filter/

其中的变化很小.那里的"multicheck-filter.component.ts"文件会给您这个错误:

Small change in it. There 'multicheck-filter.component.ts' file will give you this error:

属性值"在"FilterDescriptor"类型上不存在| CompositeFilterDescriptor'. 类型"CompositeFilterDescriptor"上不存在属性值".

Property 'value' does not exist on type 'FilterDescriptor | CompositeFilterDescriptor'. Property 'value' does not exist on type 'CompositeFilterDescriptor'.

要解决此问题,您需要在ngAfterViewInit()内替换以下给定的代码

To resolve it, you need to replace below given code inside ngAfterViewInit()

this.value = this.currentFilter.filters.map(FilterDescriptor => f.value);

this.value = this.currentFilter.filters.map(FilterDescriptor => f.value);

使用下面给出的代码.

this.value = this.currentFilter.filters.map((f:FilterDescriptor)=> f.value);

this.value = this.currentFilter.filters.map((f:FilterDescriptor) => f.value);

,还从'@ progress/kendo-data-query'导入'FilterDescriptor'.

and also import 'FilterDescriptor' from '@progress/kendo-data-query'.

这篇关于Kendo Angular 2网格过滤器类似于Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 04:01