DropdownList custom editor won't appear in popup edit mode

4 posts, 0 answers
  1. Bob
    Bob avatar
    10 posts
    Member since:
    Jul 2010

    Posted 15 Jan 2014 Link to this post

    When trying to edit a simple object that is part of my model in a grid in popup edit mode the dropdownlist editor doesn't appear.  It does appear when the grid is in inline edit mode.  Below is the relevant code snippets from a sample project I created to reproduce this behavior.  I can attach the sample project if need be.

    public class OrderModel
        {
            public int OrderNumber { get; set; }
            public int Quantity { get; set; }
            public string Item { get; set; }
            [UIHint("SupplierEditor")]
            public SupplierModel Supplier { get; set; }
        }

        public class SupplierModel
        {
            public int SupplierID { get; set; }
            public string SupplierName { get; set; }
        }


    @model KendoUIMvcApplication2.Models.SupplierModel

    @(Html.Kendo().DropDownList().Name("cboSupplier")
            .DataTextField("SupplierName")
            .DataValueField("SupplierID")
            .DataSource(d => d
                .Read("GetSuppliers", "Home")
                )
            )

    @(Html.Kendo().Grid<KendoUIMvcApplication2.Models.OrderModel>().Name("gridOrdersPopup").Columns(c =>
        {
            c.Bound(model => model.OrderNumber).Title("Order #");
            c.Bound(model => model.Item);
            c.Bound(model => model.Quantity);
            c.Bound(model => model.Supplier).ClientTemplate("#= Supplier.SupplierName #");
            c.Command(command => { command.Edit(); command.Destroy(); });
        })
        .DataSource (d => d
            .Ajax()
            .ServerOperation(false)
            .Read(read => read.Action("GetOrders", "Home"))
            .Create(update => update.Action("CreateOrder", "Home"))
            .Update(update => update.Action("UpdateOrder", "Home"))
            .Destroy(update => update.Action("DeleteOrder", "Home"))
            .Model(model => model.Id(m => m.OrderNumber))
            )
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .ToolBar(toolbar => toolbar.Create())
        .Selectable(s => s.Mode(GridSelectionMode.Single))
        .Sortable()
        .Scrollable(s => s.Height(200))
        .Resizable(resize => resize.Columns(true))
        )

  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2192 posts

    Posted 17 Jan 2014 Link to this post

    Hi Bob,

    I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide runable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

    Regards,
    Vladimir Iliev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Bob
    Bob avatar
    10 posts
    Member since:
    Jul 2010

    Posted 17 Jan 2014 Link to this post

    Attached is my sample project.  Two grids that load the same data, but one edits in popup mode and the other inline.  In pop-up mode the supplier editor doesn't appear.
  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2192 posts

    Posted 17 Jan 2014 Link to this post

    Hi Bob,

    Apologize that I mislead you  - while I testing the Grid code that you provide on our side I didn't notice that you are using nested object. Basically the PopUp template of the Grid uses the EditorForModel MVC helper to generate the template, which indeed doesn't support complex properties. That why in current case you should implement custom PopUp editor template.

    Also please note that our CodeLibrary already contains such demo which you can use as a baseline:

    Regards,
    Vladimir Iliev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top