Hi,
I've posted a question to this topic a year ago and the solution went fine. Today I updated to the newest version of Kendo UI and now I have problems with the code. Looks like the update broke things for me.
The original question was, how to bind data in a clientdata from the parent row. The solution worked by using the DetailInit Method of the Parent Grid to set the data in the datasource of the Childgrid.
http://www.telerik.com/forums/grid-bind-a-clientdetailtemplate-to-a-collection-in-parent-row
My Parent Grid looks like this:
Child Template:
And finally the DetailInit to wire it together:
As I said, everything worked fine in the last years version.
Following steps happen:
- I expand a row
- My data is shown as usual
- But now, an post server request is made to my controller action. That's pretty strange, because I didn't specify any read methods in my datasource.
- Since no data is returned from the controller, the grid will be empty as soon as the request is finished.
If I comment out the DataSource specification of the Childgrid, no request is made. But then my data is not sortedand Server Paging is enabled. Due to this, I tried to create a new datasource in the initDetail JS-Function, which has the specified sort-definition and turned off server paging. But I'm unable to set the Grid's datasource (already searched in the forums).
Was there a breaking change?
Thanks for any advices.
Greets
I've posted a question to this topic a year ago and the solution went fine. Today I updated to the newest version of Kendo UI and now I have problems with the code. Looks like the update broke things for me.
The original question was, how to bind data in a clientdata from the parent row. The solution worked by using the DetailInit Method of the Parent Grid to set the data in the datasource of the Childgrid.
http://www.telerik.com/forums/grid-bind-a-clientdetailtemplate-to-a-collection-in-parent-row
My Parent Grid looks like this:
01.
@(Html.Kendo().Grid<Models.AgentCommissionDetail>()
02.
.Name(
"commissionGrid"
)
03.
.Columns(
04.
col =>
05.
{
06.
// cols..
07.
})
08.
.ClientDetailTemplateId(
"detailTemplate"
)
09.
.DataSource(dataSource => dataSource
10.
.Ajax()
11.
.ServerOperation(
false
)
12.
)
13.
.Events(events => events.DetailInit(
"initDetail"
))
14.
.BindTo(Model.GroupedDetails)
Child Template:
01.
@(Html.Kendo().Grid<Models.AgentCommissionDetail>()
02.
.Name(
"details_#=CustomerNr#"
)
03.
.Columns(col =>
04.
{
05.
// cols
06.
})
07.
.DataSource(dataSource => dataSource
08.
.Ajax()
09.
.ServerOperation(
false
)
10.
.Sort(p => { p.Add(x => x.ArticleGroup); p.Add(x => x.DiscountGroup); p.Add(x => x.ProductGroup); p.Add(x => x.Revenue).Descending(); })
11.
)
12.
.Pageable()
13.
.Sortable()
14.
.ToClientTemplate()
15.
)
And finally the DetailInit to wire it together:
1.
function
initDetail(e) {
2.
var
grid = $(
"#details_"
+ e.data.CustomerNr).data(
"kendoGrid"
);
3.
grid.dataSource.data(e.data.Details);
4.
}
As I said, everything worked fine in the last years version.
Following steps happen:
- I expand a row
- My data is shown as usual
- But now, an post server request is made to my controller action. That's pretty strange, because I didn't specify any read methods in my datasource.
- Since no data is returned from the controller, the grid will be empty as soon as the request is finished.
If I comment out the DataSource specification of the Childgrid, no request is made. But then my data is not sortedand Server Paging is enabled. Due to this, I tried to create a new datasource in the initDetail JS-Function, which has the specified sort-definition and turned off server paging. But I'm unable to set the Grid's datasource (already searched in the forums).
Was there a breaking change?
Thanks for any advices.
Greets