Kendo Grid using inline editing and custom editor dropdown control

cmedine

I am trying to implement a custom editor for a column on a grid. The editor uses a DropdownList control.

I am able to get the Dropdown to show upon add/edit, however after making a selection and posting the json that is sent contains the default value, not the value that was selected.

My implementation is below it is an excerpt from a Razor page.

Can you help me figure out what I've done wrong here?

<div id="divGrid"></div>

<script>
    $(document).ready(function () {
        var dsGroupForm = new kendo.data.DataSource({
            transport: {
                read: {
                    url: '@Url.Action("GroupForm_Read", "Settings")',
                    dataType: "json"
                },
                update: {
                    url: '@Url.Action("GroupForm_Update", "Settings")',
                    dataType: "json"
                },
                destroy: {
                    url: '@Url.Action("GroupForm_Destroy", "Settings")',
                    dataType: "json"
                },
                create: {
                    url: '@Url.Action("GroupForm_Create", "Settings")',
                                    dataType: "json"
                }
             },
            batch: false,
            pageSize: 5,
            schema: {
                data: "Data",
                total: "Total",
                errors: "Errors",
                model: {
                    id: "GroupFormId",
                    fields: {
                        GroupFormId: { editable: false, nullable: false },
                        AdGroupId: { required: false },
                        AdGroupDisplayName: { validation: { required: true } },
                        FormKey: { validation: { required: true } },
                        Ordinal: { validation: { required: true } },
                        FormType: { validation: { required: false } },
                        FormTypeDisplay: { defaultValue: { FormTypeName: "Form1", FormTypeId: "1" } },
                        FormProjectionId: { validation: { required: false } }
                    }
                }
            }
        });

    $("#divGrid").kendoGrid({
        autobind: true,
        dataSource: dsGroupForm,
        pageable: true,
        height: 430,
        toolbar: [{ name: "create", text: "Add"}],
        columns: [
            {field: "AdGroupDisplayName", title: "Group" },
            { field: "FormKey", title: "Key" },
            { field: "Ordinal", title: "Ordinal", format: "{0:d}", width: "100px" },
            { field: "FormTypeDisplay", title: "Type", width: "150px", editor: formTypeDropDownEditor, template: "#=FormTypeDisplay.FormTypeName#" },
            { field: "FormProjectionId", title: "ProjectionId" },
            { command: [{ name: "edit", text: "Edit" }, { name: "destroy", text: "Remove" }], title: " ", width: "172px" }
        ],
        editable: "inline"
    });
});


    var formTypeData = new kendo.data.DataSource({
        data: [
            { FormTypeName: "Form1", FormTypeId: "1" },
            { FormTypeName: "Form2", FormTypeId: "2" },
            { FormTypeName: "Form3", FormTypeId: "3" }
        ]
    });

    function formTypeDropDownEditor(container, options) {
        $('<input name="FormTypeDisplay" required data-text-field="FormTypeName" data-value-field="FormTypeId" data-bind="value:' + options.field + '"/>')
            .appendTo(container)
            .kendoDropDownList({
                autoBind: true,
                dataTextField: "FormTypeName",
                dataValueField: "FormTypeId",
                dataSource: formTypeData
            });
    }
</script>
cmedine

I was able to get it working using a MVC wrapper and by following this post:

http://www.sitereq.com/post/kendo-mvc-dropdown-lists-inside-inline-kendo-mvc-grids

The key was adding the save event due to a known Kendo grid bug - seems to me the Kendo docs should have some mention of this issue.

I tried implementing the same logic using the javascript implementation but could not get it working.

Collected from the Internet

Please contact debug[email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Kendo UI Web Grid - Popup_Editor Template - Dropdown

From Dev

How can I restrict a number input between 1 to 12 in Kendo Grid Inline Editing

From Dev

Use ClientTemplate for Kendo Grid Inline Editing

From Dev

Kendo grid with declarative editor template

From Dev

What does "productService" mean in Kendo UI Grid/Inline editing

From Dev

Custom values in kendo grid "Items per page" dropdown

From Dev

How to filter a Kendo UI MVC grid using a dropdown list

From Dev

Set Kendo Grid POPUP editor values using Jquery

From Dev

Difference between Editing Custom Editor and Batch Editing for ASP.NET MVC Kendo Grid

From Dev

How to use two types of editing like popup and Inline in a single kendo Grid in asp?

From Dev

DropDown is not populating in KENDO Grid

From Dev

Binding an editor template for Kendo grid

From Dev

Multiselect list in Kendo Grid inline editing

From Dev

Kendo grid - Grouping is not working with custom editor drop down list

From Dev

kendo web ui grid batch editing on click of custom command using jquery/javascript

From Dev

pass view data to custom editor in kendo grid

From Dev

How can I restrict a number input between 1 to 12 in Kendo Grid Inline Editing

From Dev

kendo inline editor issue in firefox

From Dev

Kendo MVC Wrapper - Custom Editor if grid

From Dev

Kendo grid with declarative editor template

From Dev

Set Kendo Grid POPUP editor values using Jquery

From Dev

How to use two types of editing like popup and Inline in a single kendo Grid in asp?

From Dev

kendo-ui grid custom editor multiselect set value

From Dev

DropDown is not populating in KENDO Grid

From Dev

Kendo ui grid dropdown editor does not load data

From Dev

Kendo grid - Grouping is not working with custom editor drop down list

From Dev

Inline Editing is not working in Kendo MVC

From Dev

Kendo grid inline editing removes my drop down list current value

From Dev

Date format issue in Kendo Grid with inline editing

Related Related

  1. 1

    Kendo UI Web Grid - Popup_Editor Template - Dropdown

  2. 2

    How can I restrict a number input between 1 to 12 in Kendo Grid Inline Editing

  3. 3

    Use ClientTemplate for Kendo Grid Inline Editing

  4. 4

    Kendo grid with declarative editor template

  5. 5

    What does "productService" mean in Kendo UI Grid/Inline editing

  6. 6

    Custom values in kendo grid "Items per page" dropdown

  7. 7

    How to filter a Kendo UI MVC grid using a dropdown list

  8. 8

    Set Kendo Grid POPUP editor values using Jquery

  9. 9

    Difference between Editing Custom Editor and Batch Editing for ASP.NET MVC Kendo Grid

  10. 10

    How to use two types of editing like popup and Inline in a single kendo Grid in asp?

  11. 11

    DropDown is not populating in KENDO Grid

  12. 12

    Binding an editor template for Kendo grid

  13. 13

    Multiselect list in Kendo Grid inline editing

  14. 14

    Kendo grid - Grouping is not working with custom editor drop down list

  15. 15

    kendo web ui grid batch editing on click of custom command using jquery/javascript

  16. 16

    pass view data to custom editor in kendo grid

  17. 17

    How can I restrict a number input between 1 to 12 in Kendo Grid Inline Editing

  18. 18

    kendo inline editor issue in firefox

  19. 19

    Kendo MVC Wrapper - Custom Editor if grid

  20. 20

    Kendo grid with declarative editor template

  21. 21

    Set Kendo Grid POPUP editor values using Jquery

  22. 22

    How to use two types of editing like popup and Inline in a single kendo Grid in asp?

  23. 23

    kendo-ui grid custom editor multiselect set value

  24. 24

    DropDown is not populating in KENDO Grid

  25. 25

    Kendo ui grid dropdown editor does not load data

  26. 26

    Kendo grid - Grouping is not working with custom editor drop down list

  27. 27

    Inline Editing is not working in Kendo MVC

  28. 28

    Kendo grid inline editing removes my drop down list current value

  29. 29

    Date format issue in Kendo Grid with inline editing

HotTag

Archive