@topconsultnpm/sdkui-react 6.22.0-dev4.8 → 6.22.0-dev4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1423,8 +1423,14 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
|
|
|
1423
1423
|
// Handles focus change in the data grid
|
|
1424
1424
|
const handleFocusedRowChange = useCallback((e) => {
|
|
1425
1425
|
// Non bloccare mai questo handler: è chiamato quando l'utente clicca su una riga
|
|
1426
|
-
|
|
1427
|
-
|
|
1426
|
+
// Con il rendering virtuale la riga su cui il cambio pagina sposta il fuoco può non essere ancora disegnata:
|
|
1427
|
+
// e.row è undefined e il documento si ricava dalla chiave (altrimenti focusedRowKey ricadrebbe su 0, cioè pagina 1)
|
|
1428
|
+
const rowData = e.row?.data ?? dataSource?.find(item => item.rowIndex === e.component.option('focusedRowKey'));
|
|
1429
|
+
// La prop controllata va allineata subito: finché resta sulla riga precedente, il wrapper React
|
|
1430
|
+
// riporta lì il fuoco e autoNavigateToFocusedRow riporta la griglia alla sua pagina
|
|
1431
|
+
setFocusedItem(rowData);
|
|
1432
|
+
onFocusedItemChanged?.(rowData);
|
|
1433
|
+
}, [onFocusedItemChanged, dataSource]);
|
|
1428
1434
|
// Handler for double-click row event
|
|
1429
1435
|
const onRowDblClick = useCallback((e) => {
|
|
1430
1436
|
if (onDblClick === undefined)
|