Hi,
I'm having some trouble with setting a DropDownList value while editing a grid inline.
This is my datasource for the DropDownList:
01.var baseTypesDataSource = new kendo.data.DataSource({02. type: "json",03. transport: {04. read: {05. url: "Profile/GetBaseTypes"06. }07. },08. schema: {09. model: {10. id: "merchandisingBaseTypeId",11. fields: {12. merchandisingBaseTypeId: { type: "number" },13. merchandisingBaseType: { type: "string" }14. }15. }
This is my grid:
01.$("#merchandisingProfileGrid").kendoGrid({02. dataSource: profilesDS,03. columns: [04. { field: "profileNo", title: "Profile No" },05. { field: "palletBay", title: "Pallet Bay", editor: booleanEditor, template: kendo.template($("#palletBayTemplate").html()) },06. { field: "merchandisingBaseType", title: "Base Type", editor: BaseTypesDropdowns, template: kendo.template($("#baseTypeTemplate").html()) },07. { field: "quantity", title: "Overs Qty" },08. { field: "comments", title: "Notes" },09. { command: ["edit"], width: "200px" }10. ],11. editable: "inline",12. filterable: true13.});
And this is my custom editor for the DropDownList:
01.function BaseTypesDropdowns(container, options) {02. $('<input id="bt_' + options.model.id + '" required name="' + options.field + '" />')03. .appendTo(container)04. .kendoDropDownList({05. autoBind: true,06. dataTextField: "merchandisingBaseType",07. dataValueField: "merchandisingBaseTypeId",08. dataSource: baseTypesDataSource,09. dataBound: function (e) {10. $("#bt_" + options.model.id).data("kendoDropDownList").value(options.model.merchandisingBaseTypeId);11. },12. change: function (e) {13. var dataItem = e.sender.dataItem();14. options.model.set("merchandisingBaseTypeId", dataItem.merchandisingBaseTypeId);15. }16. });17.}
I am simply trying to retain the grid value in the dropdown when I edit a row inline.
The above code does correctly work the first time I edit a row, however on subsequent edits the dropdown loads displaying blank, but has the correct value seelcted when I expand the dropdown (can be seen in the attached image).
