New to Kendo UI for Vue? Start a free 30-day trial

filterBy<T>

Filters the provided array according to the specified CompositeFilterDescriptor.

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 CompositeFilterDescriptor | FilterDescriptor

The filter criteria that will be applied.

Returns

T[] - The filtered data.

In this article

Not finding the help you need?