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

Changing the row template after grid creation

3 Answers 269 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 07 May 2013, 03:46 PM
Hi,

Is there any way to change the row template after the grid has been created on the page?  We want to provide different views of the grid (like small icons, large icons, etc) but we also need to be able to revert back to the standard template (i.e. no overriding template/Kendo creates the template).

Any ideas how we can do this please?

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 09 May 2013, 09:21 AM
Hello Chris,

This example demonstrates how to achieve this.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chris
Top achievements
Rank 1
answered on 09 May 2013, 10:56 AM
Hi Alexander,

Thanks for your response and that works very well, but I also need a button on there to revert back to the standard template, i.e. Kendo's own template as if I never provided one, do you know how that can be done please?

I've tried setting the row template to null and undefined but neither work.
0
Alexander Valchev
Telerik team
answered on 09 May 2013, 11:13 AM
Hi Chris,

To achieve that you can store the original template in a variable:
var grid = $("#grid").kendoGrid({
    dataSource: dataSource
}).data("kendoGrid");
 
var originalRowTemplate = grid.rowTemplate;
var originalAltRowTemplate = grid.altRowTemplate;

For your convenience I updated the sample:

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Chris
Top achievements
Rank 1
Share this question
or