Skip to content

_itemKey should use dataGetter for column #102

Description

@hannaofsweden

Currently the _itemKey looks like this:

_itemKey({ rowIndex }) {
const { data, rowKey } = this.props;
return data[rowIndex][rowKey];
}

However if you use a non-standard way of getting values with a dataGetter defined for the column, this will fail.

For instance, in the project I'm doing now, I use a dataGetter to calculate row numbers and display them in a table. However it's not possible to use this value as a rowKey because of the above.

Instead the dataGetter for the column in question should be called if it exists.

Activity

  1. nihgwu commented on Oct 4, 2019

    @nihgwu
    Contributor

    itemKey is used for make the item unique in data, so you have to provide a unique identifier for each item, like id or index or sequenceId, dataGetter is used to get cell data, not row data
    dynamic identifier according to the row numbers is not same as it's not stable when adding/removing rows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions