Refresh dependent datagrids

Hi,

I have 3 grids below each other, each one is a child of the above one.
I got refresh problems with them and need an example how to set this up without grids showing data from previous selects.

Example:
(grid1 = root, grid2 = master, grid3 = slave)

root-events:
-loaddata: load root-data
-rowselect: load master-data (related to selected root-data-entry)

master-events:
-loaddata: empty
-rowselect: load slave-data (related to selected master-data-entry)

slave-events:
-loaddata: empty
-rowselect: empty

Problem with that construct:
If want to find some slave-data, the first round of selecting stuff works fine.
But if I reselect something in the root-table (the master-table gets updated fine) my slave-table shows entries which are from my previous select.
My current solution is to empty all slave-results while selecting a new root-event.
But I am not happy with that, I need some solution which can work with an endless thread of datagrids depending on each other.

Additionally it would be nice to have the possibility to select the first data-entry after a datagrids loaddata-event (which would end up in: select root-dataset -> get to see the slave-data of the first master-data-entry).

kind regards
Moo

Honestly I cannot think of а solution that would work with endlessly dependant data grids. Perhaps it would be better to show the child data in the Template of the parent grid. This way when you expand a parent record it would automatically show the children.

I think my explanation wasn't that good. My main problem is that I am already needing a crutch for 3 tables below each other, it's not about 'endless' related tables, it's more about an undefined number for which I do not want to build crutches, let's say I add another table to my example of 3, now I would have to empty all my tables result-objects (with 'Set property'), and this in multiple RowSelect-events (minimum at the second and the third table).
There has to be a way in which a selection on a table triggers the reload of another table, which itself does the same to another table.

Maybe I should load each tables data in its own event and just set a filter pointing to the parent grids selection?

If I understand your requirement correctly you want to somehow trigger the select event of a parent DataGrid when it loads. Is that right?

Nope, the other way around.
-a parent-grid loads its data
-the first data entry is selected (which I want to happen automatically)
-a child-grid loads depending data
-the first data entry is selected ... next grid ... and so on

OK. That's what I thought. Will try to prepare an example soon.

Ok thank you. I am sorry for the confusion.

This turned out to be easier than I thought.

You need to use Execute Code to invoke the RowSelect event handler of the parent DataGrid in its LoadData handler. Here is what I mean:

The full Code value is this.grid0RowSelect(this.getCategoriesResult[0]);

This will execute the selection logic when the parent DataGrid loads (as if the user selected the first record).

You can do that for all parent DataGrids.

3 Likes

Works.
Would it be possible to make a visible selection too?
I mean the selection gets triggered, but the ui does not reflect this.

Hey @Moo,

Try this.grid0.onSelect(this.getCategoriesResult[0])

2 Likes

Yes! This is perfect! Thanks to both of you :slight_smile:

Hello,
When I do write code into the 'then' part of LoadData event, it actually works. (Exactly your answer)

But in the 'Page' events, there is a code this.grid0.load() . When I put the same code under the 'Then' part of this, it does not work. I expect those things to be equal but apperantly they are not. Is this a bug or do I miss something?

Thanks,