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

Grid Detailtemplate Conclusion

1 Answer 24 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 05 Sep 2013, 07:46 AM
Hello everybody

I have a grid with a detailtemplate. This detailtemplate contains also a grid.
My parent grid refers to an Edition-Model which contains many Articles. When the user expands an Edition-Row, the detailgrid contains all correct Articles.

The problem now is, that i want to check, if one Article is allready read by the user. So i want to insert a conclusion, that i can show one or another value in a column of the detailgrid.

On this website, i found the template-syntax: http://docs.kendoui.com/getting-started/framework/templates/overview#template-syntax

But it doesnt work fine. In the detailgrid the conclusion checks every time the parent-data (Edition) and not the detaildata (Article).

My ClientTemplate (for the detail grid)
columns.Bound(c => c.IsRead).ClientTemplate("" +
                "#if(IsRead== true) {#" +
                "Read"+
                "#} else{#" +
                "Not Read +
                "#}#")
                .Title("State").Width(120);

When i put an output in the ClientTemplate as shown in the link above, then the Template renders the correct data (with the \\# syntax)

Example (clienttemplate for the detail grid):
columns.Bound(c => c.IsRead).ClientTemplate("" +
                "#if(IsRead== true) {#" +
                "#=data.Id#"+      // Shows parent Id
                "#} else{#" +
                "\\#=data.Id\\# +     // Shows the correct id from the detail row
                "#}#")
                .Title("State").Width(120);
My question now: How can I check the data of the detailrow in a conclusion??

Edit:
For better understanding: I have the sam CSharp - Model in both Grids. When i make two diffrent models, then it is the same situation. Only one diffrence: Javascript-Console says: Undifined Property (for IsRead). Because my actual Edition - Model has no property named IsRerad.

Thanks and have a nice day
MJ

1 Answer, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 09 Sep 2013, 07:11 AM
Hello Michael,

Since the ClientTemplate in the detail is a nested template, the "#" characters should be escaped so that the expression is evaluated in the correct context:

columns.Bound(c => c.IsRead).ClientTemplate("" +
                "\\#if(IsRead== true) {\\#" +
                "Read"+
                "\\#} else{\\#" +
                "Not Read +
                "\\#}\\#")
                .Title("State").Width(120);
Regards,
Daniel
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
Michael
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or