Merge pull request #2595 from tugcekucukoglu/datakey

Fixed #2589 - DataTable: support passing a function to the dataKey prop
pull/2580/head^2
Tuğçe Küçükoğlu 2022-05-31 15:04:14 +03:00 committed by GitHub
commit 0efbf12857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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: {