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

Grid edit/add mode

1 Answer 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 02 Aug 2016, 07:26 PM
Any ideas on how to either specify a field is editable if only a edit, and not a new record being added to the grid.  Either inline or popup.  What 'm trying to do is have a field required to be entered on new, but not editable afterwards.

Ideally, a way in the future to specify which editortemplate view to use on new or edit would be extremely helpful. Since it looks like I'll have inline editing, but can't use the grid create, instead it will just be a button with a custom window and form.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 04 Aug 2016, 01:13 PM
Hello Jason,

Generally, to distinguish between the insert and update modes, you can use the isNew method in conbination with the edit event handler of the grid:
http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-edit

Here is a basic sample:
Copy Code
Copy Code
.Events(events => events.Edit("onEdit"))
JavaScript:
Copy Code
Copy Code
Copy Code
Copy Code
function onEdit(args) {
    if (args.model.isNew() == false) {
            // textbox
            $("#ShipName").attr("readonly", true);
             
            // dropdownlist
            var kendoDdl = $("#ShipCountry").data("kendoDropDownList");
            kendoDdl.readonly(true);
    }
}

You can also log this idea to our public portal:
http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback

Regards,
Eyup
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or