This question is locked. New answers and comments are not allowed.
By default the value of a boolean field is displayed as the text "true" or "false". But I want a checkbox to be displayed.
So I want to add a template on the column:
My problems is how add the checked="checked" conditionally depending on the value of the field.
Any idea how to do that?
Thanks, Jaap
So I want to add a template on the column:
<input type="checkbox" checked="checked" disabled="disabled" />
My problems is how add the checked="checked" conditionally depending on the value of the field.
Any idea how to do that?
Thanks, Jaap
2 Answers, 1 is accepted
0
Accepted
Hello Jaap,
Regards,
Rosen
the Telerik team
In order to set the checked attribute based on the value of the field, you should use similar to the following template declaration:
{ field: "Discontinued", template: '<input type="checkbox" #= Discontinued ? "checked=checked" : "" # disabled="disabled" ></input>'}Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Jaap
commented on 17 Jan 2012, 11:27 AM
Top achievements
Rank 2
Ok, thank you, that did the trick.
Jaap
Jaap
Andrew
commented on 03 Feb 2012, 05:44 AM
Top achievements
Rank 1
The ....
I'm only adding this because it took me 10mins to realise the first quote was in the wrong place.
"checked=checked" .... bit should be .... checked="checked" .... I'm only adding this because it took me 10mins to realise the first quote was in the wrong place.
Jaap
commented on 03 Feb 2012, 08:25 AM
Top achievements
Rank 2
I looked in my code and saw indeed that the quote was also in the wrong place. But still it worked.
Jaap
Jaap
Juan Carlos
commented on 14 Feb 2013, 08:10 PM
Top achievements
Rank 1
How i can implement this in Razr?
{
columns.Bound(p => p.Active)
.Template(???????);
}
Thanks.
{
columns.Bound(p => p.Active)
.Template(???????);
}
Thanks.
Rosen
commented on 15 Feb 2013, 09:14 AM
Telerik team
Hi Juan,
Rosen
the Telerik team
Please refer to this help article.
Regards,Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Mike
commented on 19 Feb 2013, 04:26 PM
Top achievements
Rank 1
Rosen,
I don't see the Razor syntax in the help article that you suggested. And when I use the .ClientTemplate that you suggested, it doesn't seem to bind back to the model property.
Thanks,
Mike
I don't see the Razor syntax in the help article that you suggested. And when I use the .ClientTemplate that you suggested, it doesn't seem to bind back to the model property.
Thanks,
Mike
Leo
commented on 20 Feb 2013, 05:49 AM
Top achievements
Rank 1
Basically Is there any one who has done the two way binding on the grid for a checkbox. I want to develop a editable checkbox. but when i click it returns a textbox. not a checkbox. need a help
0
Hello Leonard,
Rosen
the Telerik team
To customize the appearance of the column during editing you should specify a column editor. Here is a demo of this functionality.
As the discussion diverged from the initial topic of the thread please consider starting a new one if further question arise.
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!