};
componentDidMount(): void {
- this.initializeCheckedList(this.props.items);
+ this.initializeCheckedList([]);
}
componentDidUpdate(prevProps: Readonly<DataTableProps<T>>, prevState: DataTableState) {
if (items.length) this.initializeCheckedList(items);
else setCheckedListOnStore({});
}
+ if (prevProps.currentRoute !== this.props.currentRoute) {
+ this.initializeCheckedList([])
+ }
+ }
+
+ componentWillUnmount(): void {
+ this.initializeCheckedList([])
}
checkBoxColumn: DataColumn<any, any> = {
const { classes, checkedList } = this.props;
return (
<input
+ data-cy={`multiselect-checkbox-${uuid}`}
type="checkbox"
name={uuid}
className={classes.checkBox}
- checked={checkedList[uuid] ? checkedList[uuid] : false}
+ checked={checkedList && checkedList[uuid] ? checkedList[uuid] : false}
onChange={() => this.handleSelectOne(uuid)}
onDoubleClick={ev => ev.stopPropagation()}></input>
);
const { onRowClick, onRowDoubleClick, extractKey, classes, currentItemUuid, currentRoute } = this.props;
return (
<TableRow
+ data-cy={'data-table-row'}
hover
key={extractKey ? extractKey(item) : index}
onClick={event => onRowClick && onRowClick(event, item)}