Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VaDataTable rows (of type TableRow) are generated based on initialIndex instead of id #1888

Closed
RVitaly1978 opened this issue May 31, 2022 · 0 comments · Fixed by #2025
Closed
Assignees
Labels
BUG Something isn't working
Milestone

Comments

@RVitaly1978
Copy link
Member

RVitaly1978 commented May 31, 2022

Vuestic-ui version: 1.4.1

Now we generate the TableRow items in this way.:

const buildTableRow = (source: ITableItem, initialIndex: number, columns: TableColumn[]): TableRow => ({
  source,
  initialIndex,
  cells: columns.map(column => buildTableCell(initialIndex, column, source)),
})

const rowsComputed = computed(() => {
  return props.items.map((rawItem, index) => buildTableRow(rawItem, index, columns.value))
})

And our row selection is based on source instead of id. This will break the selection when shuffling the items array.
We should use id instead of source if the elements have an appropriate key

@RVitaly1978 RVitaly1978 added the BUG Something isn't working label May 31, 2022
@RVitaly1978 RVitaly1978 self-assigned this Jun 22, 2022
@RVitaly1978 RVitaly1978 added this to the 1.4.5 (current) milestone Jun 29, 2022
RVitaly1978 added a commit that referenced this issue Jun 30, 2022
…ack-by` prop) (#2025)

* feat: add item-track-by prop

* feat: update useSelectableRows

* fix: minor fix demo

* fix: minor fix useSelectableRows

* fix: update type of row itemKey

* fix: rename prop

* fix: update prop

* fix: update doc examples and locales
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working
Projects
None yet
1 participant