New to KendoReactStart a free 30-day trial

distinct

Function

Definition

Package:@progress/kendo-data-query

Syntax:

ts
import { distinct } 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 = distinct(data, "subcategory");

// output:
// result => [
//     { name: "Pork", category: "Food", subcategory: "Meat" },
//     { name: "Pepper", category: "Food", subcategory: "Vegetables" }
// ];

Reduces the provided array so it contains only unique values.

Parameters:dataT[]

The array that will be reduced.

comparerstring | Comparer

An optional custom comparer function or the field name that will be used for comparison.

Returns:

T[]

  • The reduced data.
In this article
Definition
Not finding the help you need?
Contact Support