This is a migrated thread and some comments may be shown as answers.

Expand Master-Detail Grid Row by Clicking Anywhere on Row Instead of Just the + / - Icon

3 Answers 1051 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dale
Top achievements
Rank 1
Dale asked on 06 Dec 2018, 05:06 PM

I've been trying to find a way to expand a row in a master-detail grid by clicking on the row instead of just via the icon without much success. Can someone please point me in the right direction?

https://www.telerik.com/kendo-angular-ui/components/grid/advanced-features/hierarchy/

3 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 2
answered on 06 Dec 2018, 05:13 PM

Include this in your jquery document ready section:

 

//handel TR click to show hide row detail grid
$("#grid").on("click", ".k-master-row", function(e) {
    var $target = $(e.target);
    // if you have links or other things in your rows that you don't want to
    // trigger the detail row expansion, use an if statement to ignore them.
    if (!$target.hasClass("sample-link")) {
        var $this = $(this);
        var $link = $this.find(".k-icon");
        $link.click(); // just fire the click event of the kendo detail row icon
        //$this.next().find(".k-hierarchy-cell").hide(); //fix detail row spacing due to missing icon
    }
});

0
Chris
Top achievements
Rank 2
answered on 06 Dec 2018, 05:41 PM

oops - that was for the jQuery grid...

 

Look at this example

https://www.telerik.com/kendo-angular-ui/components/grid/selection/

selectableSettings

 

This might point in the right direction

 

0
Svet
Telerik team
answered on 10 Dec 2018, 09:02 AM
Hi Dale,

We can use the built-in expandRow and collapseRow methods of the grid. Basically on (cellClick) event we can call the respective method for the desired row. We can further persist the expanded rows indexes, so that we know when to expand or collapse a row.

I hope this helps. Let me know in case further assistance is required for this case. 

Regards,
Svetlin
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Dale
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 2
Svet
Telerik team
Share this question
or