0
votes

I have an editable Kendo grid, where I have a drop-down in one of the columns. Upon adding the new row to the grid the value of drop-down in the previous record resets, however that value is retained in the model.

I have created one DOJO to reproduce my issue. Any help would be highly appreciated. Click Here!!!

1

1 Answers

0
votes

Check out this sample provided by Kendo Grid with Dropdown example.

I think your code should be similar to this approach,

Dropdown Column need to use Editor and Template as shown below for the drop down.

    columns: [{ field:"ProductName",title:"Product Name" },
              { field: "Category", title: "Category", width: "180px", editor: categoryDropDownEditor, template: "#=Category.CategoryName#" },
              { field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "130px" },
              { command: "destroy", title: " ", width: "150px" }],

Dropdown creation must be follow the below approach in order to create new context for each dropdown. The below function will be called as shown above code

            function categoryDropDownEditor(container, options) {
                $('<input required name="' + options.field + '"/>')
                    .appendTo(container)
                    .kendoDropDownList({
                        autoBind: false,
                        dataTextField: "CategoryName",
                        dataValueField: "CategoryID",
                        dataSource: {
                            type: "odata",
                            transport: {
                                read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Categories"
                            }
                        }
                    });
            }

Hope this helps, :)