Skip to content

Commit 5910581

Browse files
committed
fix(AnalyticalTable): fire onRowSelected when header select all chechbox changes
1 parent ff241e1 commit 5910581

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/main/src/components/AnalyticalTable/hooks/useRowSelectionColumn.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Event } from '@ui5/webcomponents-react-base/lib/Event';
12
import { CheckBox } from '@ui5/webcomponents-react/lib/CheckBox';
23
import { TableSelectionMode } from '@ui5/webcomponents-react/lib/TableSelectionMode';
34
import React from 'react';
@@ -15,14 +16,18 @@ const noop = () => {
1516

1617
export const useRowSelectionColumn: PluginHook<{}> = (hooks) => {
1718
hooks.columns.push((columns, { instance }) => {
18-
const { selectionMode, noSelectionColumn } = instance.webComponentsReactProperties;
19+
const { selectionMode, noSelectionColumn, onRowSelected } = instance.webComponentsReactProperties;
1920

2021
if (selectionMode === TableSelectionMode.NONE || noSelectionColumn) {
2122
return columns;
2223
}
2324

2425
const toggleAllRowsSelected = (e) => {
25-
instance.toggleAllRowsSelected(e.getParameter('checked'));
26+
const allRowsSelected = e.getParameter('checked');
27+
instance.toggleAllRowsSelected(allRowsSelected);
28+
if (typeof onRowSelected === 'function') {
29+
onRowSelected(Event.of(null, e, { allRowsSelected }));
30+
}
2631
};
2732

2833
return [

0 commit comments

Comments
 (0)