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

Different Template for Create and Edit?

4 Answers 274 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 1
Marcus asked on 05 Oct 2012, 02:30 PM
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.

4 Answers, 1 is accepted

Sort by
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.
0
Vladimir Iliev
Telerik team
answered on 17 Jan 2013, 08:39 AM
Hi Marcus,

 

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);
    }
}
Kind regards,
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.
Tags
Grid
Asked by
Marcus
Top achievements
Rank 1
Answers by
Nikhil
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Klas
Top achievements
Rank 1
Share this question
or