mui-datatables icon indicating copy to clipboard operation
mui-datatables copied to clipboard

Row select malfunction with initial selecting of rows and column sorting

Open b1rt opened this issue 7 years ago • 2 comments

After initial row selection (by option "rowsSelected") and initial sorting (by "options: {sortDirection: 'asc'}"), when you try to select or unselect row, changes are made to entirely different row. After clearing selection, selecting of rows works fine.

My guess is that initial selection happens before sorting, thus indexes in selectedRowsData are not the same as in the displayed data.

Expected Behavior

After first render of table with sorting and initial selection, when you select\unselect any row, changes are made to this row.

Current Behavior

After first render of table with sorting and initial selection, when you select\unselect any row, changes are made to different row.

Snapshot of options

const tableColumns = [
    {name: 'Column1', options: {sortDirection: 'asc'}},
    {name: 'Column2'},
  ];

  const tableOptions = {
    selectableRows: true,
    rowsSelected: [0, 1, 2],

Environment

Tech Version
Material-UI 3.3.1
MUI-datatables 2.6.2
React 16.8.6
browser Chrome

b1rt avatar Jul 13 '19 19:07 b1rt

Thank you for reporting this, I should have a fix soon.

gabrielliwerant avatar Jul 13 '19 20:07 gabrielliwerant

Should be fixed in 2.6.3.

gabrielliwerant avatar Jul 14 '19 08:07 gabrielliwerant