Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Dynamically change datasource without reset hierarchical grid state (expansion, scroll bar position)
posted


Hi,

this could be an old question, but i want to clarify, in 2021 do we have any way to achieved this dynamically change datasource without reset grid state behavior?

here is my problem,

Due to the 1st level data row is too huge(>15k), i do not want to fetch all data from server and build the model at the beginning of setup the grid. (initial load may be 200 rows)

Thus, i tried few ways but none of them can achieve what we want.

1) Dynamically add more data with "igGridUpdating.addrow"

with enable the virtualization, i added code in onRendered event to perform subsequence load for the data, after that using igGridUpdating.addrow to expand the datasource.
here is the limitation:
a) the scrollbar always jump to bottom, may be want to show me the new added row?

b) it took 1-2 minute to add another 200 rows, and the UI is freeze

2) utilize igGridAppendRowOnDemand

i added code in onRequesting event to perform subsequence load, but have no idea how to expand the datasource,

it look like the "UI" table is update with new rows, if i just hard assign the new data concate with the data in ui.owner.grid.options.dataSource.settings.dataSource, ui.owner.grid.options.dataSource._data , ui.owner.grid.options.dataSource._dataView

But when perform row expansion, the dataview and the datasource seem like going crazy. i believe it was due to we are go through some proper API and the internal data is just go wrong.

here is the limitation:
a) instead of setting up the remoteUrl, can we point to some promise function to get the data? i have a local backend code to perform all the data loading, and it does not have any url

b) virtualization need to be disable


3) just set the datasource with latest data, as i mention, we will lost all the grid state