Hello again,
i noticed that for a bit(boolean) type i have the text true/false in the grid column.Is it possible to have the same checkbox like in edit mode?and if true then to be checked,if false not,also to change the text from true/false for example to yes/no ?
Regards,
Daniel
i noticed that for a bit(boolean) type i have the text true/false in the grid column.Is it possible to have the same checkbox like in edit mode?and if true then to be checked,if false not,also to change the text from true/false for example to yes/no ?
Regards,
Daniel
4 Answers, 1 is accepted
0
Hi Daniel,
editCurrentCell function:
Also you can change the default texts for boolean type using ClientTemplate:
Kind Regards,
Vladimir Iliev
the Telerik team
Basically showing the same checkbox as in edit mode which is bound to the underling model will require custom code - please check the example below:
Define client template:
columns.Bound(p => p.Discontinued).ClientTemplate("<input type='checkbox' onclick='editCurrentCell(this)' name='Discontinued' #= Discontinued? checked='checked' : '' # />");editCurrentCell function:
function editCurrentCell(element) { $("#Grid").data("kendoGrid").one("edit", function (e) { if (e.model.Discontinued) { e.model.set("Discontinued", false); } else { e.model.set("Discontinued", true); } //For testing purpose only console.log(e.model.Discontinued); }); $("#Grid").data("kendoGrid").editCell($(element).closest("td"));}Also you can change the default texts for boolean type using ClientTemplate:
columns.Bound(p => p.Discontinued).ClientTemplate("#=Discontinued ? 'yes': 'no'#");Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 28 Feb 2013, 10:17 AM
when using ClientTemplate or Template on a grid column,i can put any html code?
0
Accepted
Hi Daniel,
Vladimir Iliev
the Telerik team
You can use HTML code inside templates - for more information about the client template syntax I would suggest to check this article.
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 01 Mar 2013, 11:13 AM
it is ok now,i put also the attribute disabled=true in the template,because otherwise the checkbox can be edited without pressing the button edit,and i didn't want that.
Thanks for all the information.
Best Regards
Thanks for all the information.
Best Regards