Asp.net mvc 4 How to expand all rows at page load in Kendo UI Grid?

Asp.net mvc 4 How to expand all rows at page load in Kendo UI Grid?,asp.net-mvc-4,kendo-grid,expand,Asp.net Mvc 4,Kendo Grid,Expand,I am working on ASP.NET MVC4 with Kendo UI Grid control.And i am using expand-collapse functionality to show grid rows. My problem is at the time of page load only the first parent row child elements(rows) are expanding/showing(according to exiting code).And the other parent rows(below the first parent row) are not. But i want to show all the parent and child rows at the time of page load without any expatiation of parent rows. Below is piece of code for parent rows : @(Html.Kendo().Grid<

I am working on ASP.NET MVC4 with Kendo UI Grid control.And i am using expand-collapse functionality to show grid rows.

My problem is at the time of page load only the first parent row child elements(rows) are expanding/showing(according to exiting code).And the other parent rows(below the first parent row) are not.

But i want to show all the parent and child rows at the time of page load without any expatiation of parent rows.

Below is piece of code for parent rows :

 @(Html.Kendo().Grid<Gts.Core.Dto.CategoryViewModel>()
    .Name("CategoryItemsGrid")
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(p => p.CategoryID))
        .Read(read => read.Action("CategoryItems","Category").Data("additionalIDetail"))            
    )        

Below is piece of code for child rows :

@(Html.Kendo().Grid<Gts.Core.Dto.CategoryViewModel >()
        .Name("Categories_#=CategoryID#")    
        .DataSource(dataSource => dataSource
             .Ajax()
             .Model(model => model.Id(p => p.CategoryItemID))
             .Read(read => read.Action("CategoryChildItems", "Category", new { CategoryItemID = "#=CategoryItemID#", categoryId = "#=FKCategoryID#" }))
                    .Destroy(update => update.Action("CategoryItemsDestroy", "Category"))
                )

Can anyone knows how to fix it ?


#1

As provided in the comments above.

Kendo UI Grid does have an Expand All option.

Look here : How to expand all detail rowsi n a kendo grid


#2

Haven't done much with MVC lately (sorry about that). This is web implementation.

If for some strange reason you are having issues with just passing the collection to the dataBound handler of the grid:

    dataBound: function() {
    this.expandRow(this.tbody.find("tr.k-master-row"));
}

Try manually looping through it

 dataBound: function () {
            var that = this;

            $.each(that.tbody.find("tr.k-master-row"), function (key, value) {
                that.expandRow(value);
            });
        }

#3

Kendo UI Grid does have an Expand All option. Look here :kendoui.com/forums/kendo-ui-web/grid/… Does this help at all?

#4

Thanks Umair it's working.

#5

You are most welcome. Can you please select my answer below as the correct one for your question. Thank you.