Skip to content

Commit

Permalink
Merge pull request #373 from shesha-io/fix/datalist-selections
Browse files Browse the repository at this point in the history
Fix/datalist selections
  • Loading branch information
AlexStepantsov committed Jul 21, 2023
2 parents 136e807 + 6c26430 commit 358ef44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions shesha-reactjs/src/components/dataList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export const DataList: FC<Partial<IDataListProps>> = ({
})
);
} else {
if (typeof onSelectRow !== 'function') return;

if (onSelectRow) onSelectRow(index, row);
}
};
Expand Down
5 changes: 1 addition & 4 deletions shesha-reactjs/src/providers/dataTableSelection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ const DataTableSelectionProvider: FC<PropsWithChildren<IDataTableSelectionProvid
const selectedId = state.selectedRow?.id;
const currentId = row?.id;

// change selection only when the id differs
if (selectedId !== currentId){
dispatch(setSelectedRowAction({ index, row, id: row?.id }));
}
dispatch(setSelectedRowAction(selectedId !== currentId ? { index, row, id: row?.id } : null));
};

const setMultiSelectedRow = (rows: Row[] | Row) => {
Expand Down

0 comments on commit 358ef44

Please sign in to comment.