Is it possible to have different editor templates for the same Kendo user interface grid?

I have an MVC 3 project where I pretty often use the Kendo UI grid.

A typical view is as follows:

@using Kendo.Mvc.UI
@model List<ActionViewModel>
@(Html.Kendo().Grid<ActionViewModel>()
.Name("#grid")    
.Columns(columns =>
    {
        columns.Bound(p => p.Name);
        columns.Command(command => { command.Edit(); command.Destroy(); });
})
.ToolBar(toolbar => toolbar.Create().Text(Resources.Grid.Create))
.Editable(editable => editable.Mode(GridEditMode.PopUp)))
.Sortable()
.Scrollable()
.Filterable(f=>f.Extra(true))
.DataSource(dataSource => dataSource        
    .Ajax() 
    .Events(events => events.Error("error_handler"))
    .Model(model => model.Id(p => p.Id))
    .Create(update => update.Action("Create", "Action"))
    .Read(read => read.Action("Read", "Action"))
    .Update(update => update.Action("Update", "Action"))
    .Destroy(update => update.Action("Delete", "Action"))
))

I often have to define my own editor templates for my view models, they are used in the Kendo UI edit popup menu.

In the Kendo UI grid, you can create, update, and delete items. The popup window for editing and creation uses the same editor template by default. Is there an easy way to have two separate editor templates for editing and deleting?

+5
source share
1 answer

UPDATE

downvotes 4 , @ataravati, . : Kendo UI -

OLD ANSWER:

#, . JavaScript API "" "", - . , , .

, jQuery click listener if, , k-grid-edit k-grid-add ( , Grid). ( "" "" ) data :

$("#grid").data("action","add");

..., , , :

if ($("#grid").data("action") === "add") { /*Do stuff*/ }

(, , "" "" , , , "", " ", . , "" , "" "", ).

Kendo UI :

http://www.kendoui.com/forums/ui/grid/kendo-grid---how-to-have-different-custom-editor-for-update-and-create.aspx

, Philipp , .

, :

. . Kendo. , , . .:)

, .

+7

All Articles