Fixed #2589 - DataTable: support passing a function to the dataKey prop

pull/2595/head
Tuğçe Küçükoğlu 2022-05-31 15:03:53 +03:00
parent bb6dcfb7d3
commit 8e632d93ac
3 changed files with 6 additions and 3 deletions

View File

@ -7,7 +7,7 @@ const DataTableProps = [
},
{
name: "dataKey",
type: "string",
type: "string|function",
default: "null",
description: "Name of the field that uniquely identifies the a record in the data."
},

View File

@ -7,6 +7,8 @@ type DataTablePaginatorPositionType = 'top' | 'bottom' | 'both' | undefined;
type DataTableSortFieldType = string | ((item: any) => string) | undefined;
type DataTableDataKeyType = string | (() => string) | undefined;
type DataTableMultiSortMetaType = DataTableSortMeta[] | undefined | null;
type DataTableSortOrderType = 1 | 0 | -1 | undefined | null;
@ -465,8 +467,9 @@ export interface DataTableProps {
value?: any[] | undefined;
/**
* Name of the field that uniquely identifies the a record in the data.
* @see DataTableDataKeyType
*/
dataKey?: string | undefined;
dataKey?: DataTableDataKeyType;
/**
* Number of rows to display per page.
*/

View File

@ -93,7 +93,7 @@ export default {
default: null
},
dataKey: {
type: String,
type: [String, Function],
default: null
},
rows: {