Is it possible to use the grids hierachy feature when using a row template as I have not been able to get it to work.
I have specifed the option detailInit that defines a function handler for building the detail grid and I have tried adding the expand/contract icon to the row template
<script id="template" type="text/x-kendo-tmpl">
<tr class="k-master-row">
<td class="k-hierarchy-cell"><a href="#" class="k-icon k-plus"></a></td>
<td>Some text</td>
</tr>
</script>
When I click on the expan/contract icon it toggles between open and closed but does not call the function I have specified for creating the detail grid and I get the JavaScript error "data is undefined".
Show this scenario work and if it should any ideas what I am doing wrong?
I have specifed the option detailInit that defines a function handler for building the detail grid and I have tried adding the expand/contract icon to the row template
<script id="template" type="text/x-kendo-tmpl">
<tr class="k-master-row">
<td class="k-hierarchy-cell"><a href="#" class="k-icon k-plus"></a></td>
<td>Some text</td>
</tr>
</script>
When I click on the expan/contract icon it toggles between open and closed but does not call the function I have specified for creating the detail grid and I get the JavaScript error "data is undefined".
Show this scenario work and if it should any ideas what I am doing wrong?
5 Answers, 1 is accepted
0
Hi Matt,
Rosen
the Telerik team
I'm not sure what may cause such error on your end by looking at the provided details. Please take a look at following jsFiddle maybe I'm missing something obvious.
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Matt
Top achievements
Rank 1
answered on 01 Feb 2012, 05:21 PM
Thank you for the jsFiddle example which helped me to track down the problem.
It turns out that the script to create the grid was being executed twice. The first time with an empty array, then a second with the actual data.
I assume this should work as I see no reason why it shouldnt?
I wonder if something to do with the hierachy is initialising based on the empty array then not refreshed when the updated data is applied? It could explain why I get the javascript error "data is undefined".
It turns out that the script to create the grid was being executed twice. The first time with an empty array, then a second with the actual data.
I assume this should work as I see no reason why it shouldnt?
I wonder if something to do with the hierachy is initialising based on the empty array then not refreshed when the updated data is applied? It could explain why I get the javascript error "data is undefined".
0
Hello Matt,
Rosen
the Telerik team
I'm afraid that I did not understand you scenario nor the issue you are having from the provided details. Maybe you could provide (or modify the jsFiddle) sample which to demonstrates the issue your are facing.
All the best,Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Matt
Top achievements
Rank 1
answered on 09 Feb 2012, 12:13 PM
Hi Rosen
I have spent ages trying to recreate this in the fiddle below based on what I have assumed is the problem but have not been able to. Our code is using knockout to build the hierachy so I assume it is doing something else to provoke the error but having found a way round the problem I have run out of time to search for the root cause unfortunately.
http://jsfiddle.net/FBQZQ/13/
I have spent ages trying to recreate this in the fiddle below based on what I have assumed is the problem but have not been able to. Our code is using knockout to build the hierachy so I assume it is doing something else to provoke the error but having found a way round the problem I have run out of time to search for the root cause unfortunately.
http://jsfiddle.net/FBQZQ/13/
0
Hello Matt,
All the best,
Rosen
the Telerik team
In the jsFiddle you have provided, a new Grid instance is created over the same element on every "load data" click which is not supported and will cause unexpected behaviors.
Instead you should modify the click handler code to be similar to the following:
$(
'.loadData'
).click(
function
() {
$(
"#grid"
).data(
"kendoGrid"
).dataSource.data(gridData);
});
All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!