Skip to content

Commit

Permalink
Merge pull request #2595 from tugcekucukoglu/datakey
Browse files Browse the repository at this point in the history
Fixed #2589 - DataTable: support passing a function to the dataKey prop
  • Loading branch information
tugcekucukoglu authored May 31, 2022
2 parents bb6dcfb + 8e632d9 commit 0efbf12
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api-generator/components/datatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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."
},
Expand Down
5 changes: 4 additions & 1 deletion src/components/datatable/DataTable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/datatable/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default {
default: null
},
dataKey: {
type: String,
type: [String, Function],
default: null
},
rows: {
Expand Down

0 comments on commit 0efbf12

Please sign in to comment.