[英]Get filter values in kendo grid ui
I have kendo grid as 我有剑道网格作为
<kendo-grid
[data]="gridData"
[pageSize]="state.take"
[skip]="state.skip"
[sort]="state.sort"
[filter]="state.filter"
filterable="menu"
(dataStateChange)="dataStateChange($event)"
>
and in component.ts file 并在component.ts文件中
public dataStateChange(state: DataStateChangeEvent): void {
this.state = state;
// get filter values here
}
I want to get the filter values and field names in above function and pass them to api for server side filtering but unable to extract the values from state. 我想在上面的函数中获取过滤器值和字段名称,并将它们传递给api进行服务器端过滤,但无法从状态中提取值。
Is there any way to extract fields and values from state object? 有什么方法可以从状态对象中提取字段和值?
Primitive variant 原始变体
import { isCompositeFilterDescriptor } from '@progress/kendo-data-query';
....
const filterValues = state.filter.filters.map(f => isCompositeFilterDescriptor(f) ? f.filters :[f] ).reduce((p,n) => p.concat(n), []);
But you should check "logic" field, see https://www.telerik.com/kendo-angular-ui/components/dataquery/api/CompositeFilterDescriptor/ 但是您应该检查“逻辑”字段,请参阅https://www.telerik.com/kendo-angular-ui/components/dataquery/api/CompositeFilterDescriptor/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.