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

Master-Detail Grid onload all rows collapsible

2 Answers 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Deepti
Top achievements
Rank 1
Veteran
Deepti asked on 15 Mar 2021, 02:26 PM

I designed the Master-detail grid view. But, when I run the code it always show the first row expanded. How to make all rows collapsible on load of page? Rows will be expanded when I click on expand icon.

Example followed : https://demos.telerik.com/aspnet-mvc/grid/detailtemplate

2 Answers, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 18 Mar 2021, 11:42 AM

Hi Deepti,

The linked demo has additional logic that opens the first detail upon loading. If you would like to prevent this on your side, remove the DataBound event:

.Events(events => events.DataBound("dataBound"))

<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first()); //remove this line or the whole event
    }
</script>

Regards,
Tsvetomir
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.

0
Deepti
Top achievements
Rank 1
Veteran
answered on 24 Mar 2021, 03:01 PM
Thanks! It is working.
Tags
Grid
Asked by
Deepti
Top achievements
Rank 1
Veteran
Answers by
Tsvetomir
Telerik team
Deepti
Top achievements
Rank 1
Veteran
Share this question
or