Row selection before table fully inited failed

If a row was selected before table was fully initialized it would
be unselected once the row was fully initialized.
This commit is contained in:
Tobias Johansson 2019-03-14 10:50:46 +01:00
parent 4136da110f
commit ace091c998

View File

@ -152,6 +152,11 @@ let PillarTable = Vue.component('pillar-table-base', {
return this.rowsSource.thenInit();
})
.then(() => {
let currentlySelectedIds = this.selectedItems.map(it => it._id);
if (currentlySelectedIds.length > 0) {
// User has clicked on a row while we inited the rows. Keep that selection!
tableState.selectedIds = currentlySelectedIds;
}
this.rowAndChildObjects.forEach(tableState.applyRowState.bind(tableState));
this.isInitialized = true;
})