New to KendoReactStart a free 30-day trial

filterBy<T>

Filters the provided array according to the specified CompositeFilterDescriptor.

ts
import { filterBy } from '@progress/kendo-data-query';

const data = [
 { name: "Pork", category: "Food", subcategory: "Meat" },
 { name: "Pepper", category: "Food", subcategory: "Vegetables" },
 { name: "Beef", category: "Food", subcategory: "Meat" }
];

const result = filterBy(data, {
    logic: 'and',
    filters: [
          { field: "name", operator: "startswith", value: "p", ignoreCase: true },
          { field: "subcategory", operator: "eq", value: "Meat" },
    ]
});

// output:
// [{ "name": "Pork", "category": "Food", "subcategory": "Meat" }]

Parameters

data

T[]

The data that will be filtered.
descriptor

FilterDescriptor | CompositeFilterDescriptor

The filter criteria that will be applied.

Returns

T[]

- The filtered data.
Not finding the help you need?
Contact Support