Loading records into a grid at runtime

Hello

As an alternative to my first design I am looking to load records into a datagrid based on the selection from another datagrid. Although the data in the selection grid is not exactly the same as the other datagrid i am looking at using the id to lookup the record and add to the dataset. I thought that this would be fairly easy to do but at the moment my datagrid just shows the loading arrow and no data. Can you let me know firstly is this possible and if there are any examples of this?

Thanks

Hi @Otis,

Your child data are not coming from a SQL table or service? In this case you can execute custom method and retrieve an in-memory collection of data:

Hello
It is coming from a SQL table but i am looking to store it in a variable before storing them properly

Master/Detail template is a good start:


The child grid data are retrieved from master grid record id:

If you do not want to use the generated method for the child SQL table you can always use custom method.

I can sort of see where you are coming from but that isnt quite right. Maybe if i explain my need a bit better it would help.

I have a list of items that also includes how many of those items we have available. Instead of listing all of those items individually I have created a view to show them distinctly (along with a few other calculated values) this is then presented in the first datagrid. The next datagrid will be a selection from the first one but on select the user can change some of the details about the selection and then that selection is saved as a separate record within the same table.

Because the views shape is, and has to be, slightly different from the table it is derived from I cannot do a straight relationship and as i do not want part saved records i would prefer we keep the selected records in memory (variables) until the user is sure.

Does that help? :slight_smile:

Well, I was not aware of your architecture and was just explaining how to create master/detail with two DataGrid components. When you select a record from the master grid you can call a method to retrieve child data. Yes, the default Radzen master/detail template is using database relationships to enable selection of child data however with custom methods you can retrieve your data from whatever source. The approach stays the same.

ok, so it seems that i was doing the right thing the first time. However, when I try to get the datagrid to show the record it just shows the loading graphic and nothing else. I can see from the browser that the data is being queried and read back ok but the grid doesnt show it. Can the datagrid start from being empty and then have data within it?

Yes the grid can start empty, you can debug the query with your browser dev tools.