Is it possible to create a custom row expand button?

1 Answer 82 Views
Grid
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Vincent asked on 08 Oct 2021, 07:26 AM

Currently I'm using the Kendo native grid component and I want to make use of the master-detail template functionality:

https://www.telerik.com/kendo-vue-ui/components/grid/custom-rendering/hierarchy/

 

However when enabling this the expand buttons are always on the left column and I can't change the styling easily. 

Is it possible to make a custom expand button via the use of a function or something that will also open each row's detail template?

1 Answer, 1 is accepted

Sort by
0
Petar
Telerik team
answered on 08 Oct 2021, 08:01 AM

Hi Vincent,

To achieve what you want, you can use the approach demonstrated in this StackBlitz example. You will see that in this example the opened/closed state of the detail field is controlled by the button in the last column of each row. 

The key to the implementation of your scenario is to control the expanded field of the dataItem as in the below toggleRow method.

toggleRow: function (dataItem: any) {
    dataItem.expanded =
    dataItem.expanded === undefined ? true : !dataItem.expanded;
}

I hope the provided example will help you achieve what you need. 

Regards,
Petar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Petar
Telerik team
Share this question
or