Is there a way to make something editable only on create and not on edit in the editor?
To specify what I mean.
I would like different rules for editable depending on whether you have add new or edit old post. Some key fields cannot be edited once you done the initial create.
To specify what I mean.
I would like different rules for editable depending on whether you have add new or edit old post. Some key fields cannot be edited once you done the initial create.
4 Answers, 1 is accepted
0
Nikhil
Top achievements
Rank 1
answered on 14 Jan 2013, 02:32 PM
Hey Marcus,
Did you get your issue resolved? I am facing a similar issue and it would really be great if you could help me with it.
Did you get your issue resolved? I am facing a similar issue and it would really be great if you could help me with it.
0
Hi Marcus,
onEdit function:
Kind regards,
Vladimir Iliev
the Telerik team
Basically you can use the Edit event to check if the current model is new to find the required field editor and disable it - please check the example below:
Define Edit event handler:
.Events(e => e.Edit(
"onEdit"
))
onEdit function:
function
onEdit(e) {
//Check if the record is new
if
(!e.model.isNew()) {
popUp = e.container;
//Find the field that must be disabled / hided
fieldForDisable = popUp.find(
"#OrderDescription"
).prop(
'disabled'
,
true
);
}
}
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
Klas
Top achievements
Rank 1
answered on 17 Jan 2013, 08:58 AM
This is what I did but it would be nice in the future to be able to specify different templates for different modes, You can get alot of script otherwise.
0
Nikhil
Top achievements
Rank 1
answered on 17 Jan 2013, 02:49 PM
Hi Vladimir,
If you could please show me a code snippet to give the same functionality while using the grid in Inline editing mode, that would really be great.
If you could please show me a code snippet to give the same functionality while using the grid in Inline editing mode, that would really be great.