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

Dynamic Hierarchic Grid

2 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rostislav
Top achievements
Rank 2
Rostislav asked on 07 Oct 2013, 12:07 PM
Hello, 
i have a standard grid like this:
@(Html.Kendo().Grid<ItemModel>(Model)
  .Name("Grid")
  .Columns(columns =>
  {
    columns.Bound(p => p.Name).Title("Name");
  })
)
My model looks similar to this: 
class ItemModel
{
  string Name;
  Item Items[];
}
 
class Item
{
 string Name;
 DateTime Created;
}
Page Model contains an array of ItemModel and i would like to display the Items field as a separate grid for each corresponging ItemModel.
Is it possible to achieve this in an easy way (preferably setting and filtering data source straight from the page Model, since it is already loaded in) ?
I was fooling around a lot with provided examples, but i wasn't able to fill the hierarchic grid with the right data. 
Thank you for any suggestion.

Rostislav Striz

2 Answers, 1 is accepted

Sort by
0
Rostislav
Top achievements
Rank 2
answered on 07 Oct 2013, 01:30 PM
EDIT:  
Something like this obviously works...
@(Html.Kendo().Grid<Item>()
           .Name("grid_#=Name#")
           .Columns(columns =>
           {
             columns.Bound(p => p.Created);
           })
           .DataSource(dataSource =>  dataSource
             .Ajax()
             .Read(read => read.Action("Action", "Controller", new { PName= "#=Name#"})))
           .ToClientTemplate()
   )
But i was wondering if there is a way to get the data without the need of loading them from a different action (from the page Model)?
0
Vladimir Iliev
Telerik team
answered on 09 Oct 2013, 08:14 AM
Hi,

 
Please note that we already provide such example in our CodeLibrary which demonstrates a how to edit a nested collection with another Grid and perform single request to update both the parent and the child grids with a single request: 

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Rostislav
Top achievements
Rank 2
Answers by
Rostislav
Top achievements
Rank 2
Vladimir Iliev
Telerik team
Share this question
or