How do I implement a different detail grid for each record in master grid
1 Answer 12 Views
Prateek
Top achievements
Rank 1
Prateek asked on 15 Jul 2021, 03:49 AM

Hello,

I have a master kendo grid which has records of different types in it (implemented using HTML+JQuery).
I wish to use the 'Detail Template' for the records
However the details grid needs to be different for each record type (the columns of the detail grid will differ for each master record).

From the documentation I could figure out only 1 detail template can be provided in the master grid.
Can I have different detail templates based on the master grid record type?

Alternatively is there any other approach I can take to implement this functionality?

Any help appreciated.

1 Answer, 1 is accepted

Sort by
1
Georgi Denchev
Telerik team
answered on 19 Jul 2021, 10:50 AM

Hi, Prateek,

You can have only 1 detail template at a time. You may change the template after the grid has been initialized, however this would affect all Child rows.

Based on the provided description, I would suggest you follow the approach from the Grid Hierarchy demo and create different Grid configurations for each of the "record types".

function detailInit(e) {
            // Use an "if" condition to check the "type" of the row and initialize Grid with a certain configuration.
            if(e.data.FirstName === "Nancy") {
              $("<div/>").appendTo(e.detailCell).kendoGrid({

Example in Dojo:

https://dojo.telerik.com/@gdenchev/aSADAxOf 

Expanding the "Nancy" row will reveal a Grid with 4 columns, expanding the rest of the rows will reveal Grids with only 2 columns.

The example demonstrates a Grid hierarchy, however the template can be anything you want, it isn't necessary to be a Grid.

Best Regards,
Georgi Denchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Prateek
Top achievements
Rank 1
commented on 22 Jul 2021, 02:19 PM

This is exactly what I was looking for
Thanks Georgi !
Tags
Grid
Asked by
Prateek
Top achievements
Rank 1
Answers by
Georgi Denchev
Telerik team
Share this question
or