@@ -126,7 +126,7 @@ export default class HdsTable extends Component<HdsTableSignature> {
126
126
} else {
127
127
// We return a default key to cause an update operation instead of replacement when the model changes to side-step
128
128
// a bug in Ember which would cause the table to lose its selection state
129
- return this . args . identityKey ?? 'hds-table-key ' ;
129
+ return this . args . identityKey ?? '@identity ' ;
130
130
}
131
131
}
132
132
@@ -295,7 +295,7 @@ export default class HdsTable extends Component<HdsTableSignature> {
295
295
console . log (
296
296
`[${ this . args . caption } ] Did insert row checkbox` ,
297
297
selectionKey ,
298
- this . _selectableRows . map ( ( row ) => row . selectionKey )
298
+ this . _selectableRows . map ( ( row ) : string => row . selectionKey )
299
299
) ;
300
300
301
301
if ( selectionKey ) {
@@ -310,12 +310,25 @@ export default class HdsTable extends Component<HdsTableSignature> {
310
310
console . log (
311
311
`[${ this . args . caption } ] Will destroy row checkbox` ,
312
312
selectionKey ,
313
- this . _selectableRows . map ( ( row ) => row . selectionKey )
313
+ this . _selectableRows . map ( ( row ) : string => row . selectionKey )
314
314
) ;
315
315
316
- this . _selectableRows = this . _selectableRows . filter (
317
- ( row ) : boolean => row . selectionKey !== selectionKey
316
+ // Fix for selectableRows state not being maintained properly when model updates:
317
+ // Delete the first row with the given selction key you find from the selectableRows array
318
+ // Search for the index of the row to delete. If found, delete it.
319
+ // (Fixes issue of not rows not being properly selectable including "select all" functionality)
320
+ const rowToDeleteIndex = this . _selectableRows . findIndex (
321
+ ( row ) : boolean => row . selectionKey === selectionKey
318
322
) ;
323
+
324
+ if ( rowToDeleteIndex > - 1 ) {
325
+ this . _selectableRows . splice ( rowToDeleteIndex , 1 ) ;
326
+ }
327
+
328
+ // ORIGINAL:
329
+ // this._selectableRows = this._selectableRows.filter(
330
+ // (row): boolean => row.selectionKey !== selectionKey
331
+ // );
319
332
this . setSelectAllState ( ) ;
320
333
}
321
334
0 commit comments