5 Answers, 1 is accepted
0
Hello John,
Kind regards,
Daniel
the Telerik team
Only one editor template is supported. If you need to show different fields then I can suggest to use the Grid edit event to find and hide the needed ones for the mode. The mode can be determined through the model isNew method e.g.
function
edit(e) {
if
(e.model.isNew()) {
//create
}
else
{
//edit
}
}
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chrys
Top achievements
Rank 1
answered on 14 Feb 2013, 04:50 PM
So how would I access the different templates? would I just call them by name $('#templatename')?
0
Hello Chrys,
Daniel
the Telerik team
I am not sure if I understand correctly your question. Could you clarify a bit? As general information I can say that the editor cannot be added in the edit event because it is called after the edit container has already been bound. Instead when using the wrappers, the editors for both cases should be added and then hidden or removed in the aforementioned event.
Regards,Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chrys
Top achievements
Rank 1
answered on 18 Feb 2013, 02:57 PM
Now that I understand the answer better. How would would I specify which field were hidden or not in the function you have provided?
show email from model
function
edit(e) {
if
(e.model.isNew()) {
//create
show username from model
show firstname from model
show lastname from model
show email from model
}
else
{
//edit
show username from modelshow email from model
}
}
0
Hello Chrys,
You could also wrap the fields that should not be visible in a container and hide it.
Regards,
Daniel
the Telerik team
For this scenario it would be easiest to leave all inputs visible in the template and then hide the unneeded for the operation e.g.
function
edit(e) {
if
(!e.model.isNew()) {
$(
"#firstname"
).hide();
$(
"#lastname "
).hide();
}
}
Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!