diff --git a/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.test.tsx b/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.test.tsx index c58fd2c22ec2ae..c1600c73caa6a1 100644 --- a/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.test.tsx @@ -94,6 +94,7 @@ describe('getUseCellActionsHook', () => { dataGridRef: mockDataGridRef, ecsData: [], pageSize: 10, + pageIndex: 0, }), { wrapper: TestProviderWithActions, @@ -118,6 +119,7 @@ describe('getUseCellActionsHook', () => { dataGridRef: mockDataGridRef, ecsData: [], pageSize: 10, + pageIndex: 0, }), { wrapper: TestProviderWithCustomStateAndActions, diff --git a/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.tsx b/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.tsx index 71eaa81c026261..a36678841a9047 100644 --- a/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_cell_actions.tsx @@ -23,6 +23,8 @@ export const getUseCellActionsHook = (tableId: TableId) => { columns, data, dataGridRef, + pageSize, + pageIndex, }) => { const getFieldSpec = useGetFieldSpec(SourcererScopeName.detections); const dataViewId = useDataViewId(SourcererScopeName.detections); @@ -79,10 +81,10 @@ export const getUseCellActionsHook = (tableId: TableId) => { const getCellValue = useCallback( (fieldName, rowIndex) => { - const pageRowIndex = rowIndex % finalData.length; - return finalData[pageRowIndex].find((rowData) => rowData.field === fieldName)?.value ?? []; + const pageRowIndex = rowIndex - pageSize * pageIndex; + return finalData[pageRowIndex]?.find((rowData) => rowData.field === fieldName)?.value ?? []; }, - [finalData] + [finalData, pageIndex, pageSize] ); const disabledActionTypes = diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_table.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_table.tsx index fcb6186114963f..2939d2cdcfca06 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_table.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_table.tsx @@ -454,6 +454,7 @@ const AlertsTable: React.FunctionComponent = (props: AlertsTab ecsData: ecsAlertsData, dataGridRef, pageSize: pagination.pageSize, + pageIndex: pagination.pageIndex, }) : getCellActionsStub; diff --git a/x-pack/plugins/triggers_actions_ui/public/types.ts b/x-pack/plugins/triggers_actions_ui/public/types.ts index 0bbcc5e90c7a9f..ad8d62fc0ea4da 100644 --- a/x-pack/plugins/triggers_actions_ui/public/types.ts +++ b/x-pack/plugins/triggers_actions_ui/public/types.ts @@ -668,6 +668,7 @@ export type UseCellActions = (props: { dataGridRef: RefObject; ecsData: unknown[]; pageSize: number; + pageIndex: number; }) => { // getCellAction function for system to return cell actions per Id getCellActions: (columnId: string, columnIndex: number) => EuiDataGridColumnCellAction[];