问题
How can We implement an excel-like filtering on a grid using kendo-angular. I can't find a solution in the documentation.
This is the feature in JQuery version: http://demos.telerik.com/kendo-ui/spreadsheet/sorting-filtering
edit 1: a filter similar to this one
回答1:
Here is an example:
<kendo-grid-column field="ProductName" title="Product Name">
<ng-template kendoGridFilterCellTemplate let-filter let-column="column">
<kendo-grid-string-filter-cell
[showOperators]="false"
[column]="column"
[filter]="filter">
</kendo-grid-string-filter-cell>
</ng-template>
</kendo-grid-column>
http://www.telerik.com/kendo-angular-ui/components/grid/filtering/built-in-template/
回答2:
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/
Small change in it. There 'multicheck-filter.component.ts' file will give you this error:
Property 'value' does not exist on type 'FilterDescriptor | CompositeFilterDescriptor'. Property 'value' does not exist on type 'CompositeFilterDescriptor'.
To resolve it, you need to replace below given code inside ngAfterViewInit()
this.value = this.currentFilter.filters.map(FilterDescriptor => f.value);
With below given code.
this.value = this.currentFilter.filters.map((f:FilterDescriptor) => f.value);
and also import 'FilterDescriptor' from '@progress/kendo-data-query'.
来源:https://stackoverflow.com/questions/45981486/kendo-angular-2-grid-filter-similar-to-excel