Open kwojcikowski opened 2 months ago
Not sure if we can fix the afterRender from calling as it may render twice with paging (one the empty grid then the one with pages).
Other ideas to take an array of selected ids and select them
a) In the data mark each row to be selected on the _selected
field i.e. `dataset: [{..., _selected: true})
b) Populate the _selectedRows array on the grid
c) after loading the data in the next statement called selectRow(idx) instead of afterrender
Describe the bug What I am trying to achieve is to use an array of ids to indicate which rows should be selected on a datagrid. My assumption was to use afterRender hook and go through that array and select corresponding rows. Also, when manually selecting/deselecting records I want to update the array to I used selected hook. This is what happens:
Datagrid is loaded, afterRender is triggered with the source below:
Rows are selected based on an array
Now, settingsChanged is triggered, which causes the datagrid to rerender
When datagrid is rerendered I believe a deselctall is triggered which clears my array because of selected hook
The afterRender is triggered (source below). Now I am unable to select the desired records because the array has been cleared.
Expected behavior There could be couple of solutions. What I think would be best is to have a hook similar to renrered that will trigger after the datagrid is fully initialized including paging etc.
Current workaround I have managed to find a workaround to this issue and trigger the selection on 2nd afterRender but this is really not the greates way to approach this
Version
Platform