-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
IMPORTANT INFO :
REACT VERSION : 16.13.1
REACT-DATA-GRID VERSION : 7.0.0-canary.16
BROWSER : CHROME Version 87.0.4280.141 (Official Build) (64-bit)
TYPE OF REQUEST : BUG REPORT
DESCRIPTION :
The issue I am facing occurs when grouping and row selection exists together and the rowSelection prop's selectBy is assigned with keys instead of indexes.
Current behaviour is that the when the grid is grouped and the user checks the select all button, all rows gets checked except for the ones that are collapsed. and this happens when deselecting all as well.
In my opinion, this behaviour should work fine and regardless of collapsed/ expanded rpw state, all rows should be selected or deselected.
STEPS TO REPRODUCE
Setup grid with grouping and row selection (selectBy should be initialized with keys).
Collapse one or many groups
Click check all checkbox on the top of the grid
Every row will be checked except for the ones which were collapsed,
SAMPLE CODE
`import ReactDataGrid, { SelectColumn, , Row as GridRow } from 'react-data-grid';
import { DragDropContext } from 'react-beautiful-dnd';
import { ContextMenu } from 'react-contextmenu';
class DocListTable extends React.Component {
constructor(props) {
super(props);
this.state = {
allDocuments: props.documents,
displayedDocuments, //set based on expand/collapse
columns: this.defaultColumns,
expandedRows: [],
selectedRows: new Set(),
selectedDocuments: [],
sortColumn: 'name',
sortDirection: 'ASC',
filters: [],
gridWidth: 750,
};
}
render() {
return (
<ReactDataGrid
rowKey="id"
ref={node => this.grid = node}
columns={this.state.columns}
rows={this.state.displayedDocuments}
enableFilters={this.props.displayFilters}
minColumnWidth="235"
selectedRows={this.state.selectedRows}
onSelectedRowsChange={this.setSelectedRows}
sortColumn={this.state.sortColumn}
sortDirection={this.state.sortDirection}
onSort={this.handleSort}
emptyRowsView={this.emptyRowsView}
onColumnResize={this.resizeColumn}
rowRenderer={this.rowRenderer}
/>
<ContextMenu id="grid-context-menu" hideOnLeave>
<Access roles={['ADMIN']}>
<UpdateDocumentModal contextOpen getContextDoc={this.getContextDoc} documents={this.state.contextDocuments} reRenderParent={this.props.reRenderParent} />
</Access>
</ContextMenu>
</Segment>
);
}
}
export default DocListTable;`
The row count/selection functionality is an integral part of our application, so if the team can fix this or provide an update that might prove helpful in handling this , it will be really helpful.
Thanks in advance!
p.s. Please tag if any additional info is required.