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
605
XamGrid: incremental data loading
posted

Hello

I am using XamGrid for a hierarchical data structure. Due to the huge amount of data I would prefer to load the data only step by step. I have two questions in regards to this incremental loading of data.

 The data of the lowest level ought to be loaded only if I expand the adjoining above row. However, if I do not load the data of the lowest level, there is no arrow visible in the beginning of the row with which I can expand the lowest level. This is understandable, as the lower level does not yet contain any loaded data. But how can I influence the visibility of this arrow and the options of expanding the lower levels without having to first load the lowest level?

 I would also like to load the data incrementally. Meaning the first 100 rows in the beginning, then the next 100 rows and so forth. I do not want to use Paging or Load on Demand, instead I would like to have a button towards the ending with which I can influence manually the loading of the next data.

What do I have to do in order to create such a button on each hierarchy level  below the already loaded rows in XamGrid (see picture)?

This button shall not be displayed if there is no further data to be loaded.

Sincerly

Kasar

  • 34510
    Offline posted

    Hi Kasar,

    The XamGrid only displays expansion indicators for rows that have child data so what you can do is when you load your main parent rows you can give them one dummy child record.  Then you can handle the RowExpansionChanged event off the XamGrid in order to detect when a user is going to expand a row.  Upon detecting this you can remove the dummy child row and load in your actual data.

    As far as adding a LoadNext button to your child data, this might get a bit tricky.  The only way I can think of to do this would be to use a TemplateColumnLayout.  TemplateColumnLayout lets you place anything inside the child area.  My thinking is that you would have another XamGrid displayed inside here bound to the child data, and then below that XamGrid you would have a button for LoadNext().

    For the LoadNext button below the main parents, you can place this button outside the XamGrid positioned directly below it.  When clicked you can just add the next 100 rows to your data source.  The XamGrid will automatically reflect this change and show the new rows.