You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
ids-enterprise-ng: 15.6.1
Platform
Device (if applicable) Dell laptop
OS Version: Windows 11
Browser Name: Chrome
Browser Version: Version 127.0.6533.122 (Official Build) (64-bit)
The text was updated successfully, but these errors were encountered:
tmcconechy
changed the title
Datagrid - afterRender called twice when paging is enabled
Datagrid: afterRender called twice when paging is enabled
Aug 23, 2024
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
The text was updated successfully, but these errors were encountered: