Hi Team,
I am using Hierarichal grid load on demand.
I wanted to open the child grid whose id is stored in my local storage after the parent grid is loaded with data. However I couldn't find any event that gets triggered which signals that the data is loaded and grid is rendered.Meanwhile i am using setTimeOut () method but this is not a good approach. I am on :
Angular: 9
Please reply ASAP as this is an ongoing project.
I understand, however, I would still suggest the same. As you are controlling when the data in your grid is loaded, that is when the expandRow method should be invoked. My suggestion is to debug the flow of events in your app to check why the sequence is not as required.
Thank you for replying. I am already using observables and cdr.detectChanges() method but at times when the browser is slow to load, my expandRow is getting called before the Parent grid is loaded.
Hi,
As you are adopting the load on demand approach, this means you are calling some type of a method, service, etc. that fetches data, aren’t you? Usually, in Angular and in reactive programming, the established pattern for this is subscribing to an observable. In the observer method, the data is available and that is where any actions that require it to be available are to be made. No event emitted by the grid is actually needed. Please, keep in mind that this is a general concept, though, and not something coming from Infragistics components.
So, it can look like this for example, as in our Load on demand demo:
I can also suggest actually restoring the state after the parent hierarchical grid data is fetched and assigned. That would be the place to invoke the expandRow method as well.
Best regards, Bozhidara Pachilova Associate Software Developer
Requirement: On page reload, i want to expand the child grid of the last expanded ID before reload. I am taking care with the help of local storage.But at times, the Parent Grid data is taking longer to load and render the data due which my expand method is called before the parent grid data is rendered.So is there any event or way to know if the Data in Parent Grid is loaded?TS:
Hi Shobhana,
A parent row can be expanded with the help of the expandRow method of the grid, available in the earlier 9.1.28 version as well. Since you would like a child grid to be shown, its parent record’s ID has to be stored, rather than a child grid identificator itself.
Since you are using load on demand, this indicates you are fetching the data, for example from a service, and so you are in control of when and how this happens, that is when the data is assigned or bound. Having this in mind, this would be the place to execute whatever logic you would like, once the data is bound. Namely, there can be invoked the expandRow method.
Finally, I am unable to understand what is the setTimeout() method used for, based on the provided description, nevertheless, in this sample, I tested that the expandRow method call does not need to be invoked from a setTimeout/requestAnimationFrame callback in order for the row to be expanded. Nevertheless, if in your app this is needed due to some application specifics, I would not say that this is a wrong approach, as it simply schedules a new task in the browser queue and gives the chance for the needed updates to take effect berforehand.
If you need further assistance, my suggestion is to fork and modify any of our documentation demos to better illustrate your application setup, scenario and explain the requirements. Thank you for your cooperation.
Best regards, Bozhidara Pachilova