File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
infrastructure/control-panel/src Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 69
69
sortOrder? : ' asc' | ' desc' ;
70
70
onSelectionChange? : (index : number , checked : boolean ) => void ;
71
71
onSelectAllChange? : (checked : boolean ) => void ;
72
+ selectedIndices? : number []; // Array of selected row indices
72
73
}
73
74
74
75
let {
92
93
sortOrder,
93
94
onSelectionChange,
94
95
onSelectAllChange,
96
+ selectedIndices = [],
95
97
... restProps
96
98
}: ITableProps = $props ();
97
99
100
102
let checkAll = $state (false );
101
103
let checkItems = $derived <boolean []>(tableData .map (() => false ));
102
104
105
+ // Sync checkbox states with selectedIndices prop
106
+ $effect (() => {
107
+ if (selectedIndices && selectedIndices .length > 0 ) {
108
+ // Update individual checkboxes based on selectedIndices
109
+ checkItems .forEach ((_ , index ) => {
110
+ checkItems [index ] = selectedIndices .includes (index );
111
+ });
112
+
113
+ // Update header checkbox state
114
+ checkAll = selectedIndices .length === tableData .length ;
115
+ } else {
116
+ // Clear all selections
117
+ checkItems .forEach ((_ , index ) => {
118
+ checkItems [index ] = false ;
119
+ });
120
+ checkAll = false ;
121
+ }
122
+ });
123
+
103
124
function toggleCheckAll(checked : boolean ) {
104
125
checkAll = checked ;
105
126
Original file line number Diff line number Diff line change 262
262
handleSelectedRow ={handleEVaultRowClick }
263
263
onSelectionChange ={handleEVaultSelectionChange }
264
264
onSelectAllChange ={handleSelectAllEVaults }
265
+ selectedIndices ={selectedEVaults }
265
266
/>
266
267
{/if }
267
268
</TableCard >
304
305
{handleNextPage }
305
306
onSelectionChange ={handlePlatformSelectionChange }
306
307
onSelectAllChange ={handleSelectAllPlatforms }
308
+ selectedIndices ={selectedPlatforms }
307
309
/>
308
310
{/if }
309
311
</TableCard >
You can’t perform that action at this time.
0 commit comments