Hi.
I have a grid and i want to create a inline drop down. I cannot add drop down editor to the field in the grid. Can you please let me know where i am incorrect in this.
<div id="partnerGrid"></div>
function mpnDropDownEditor(container, options) {
$('<input required name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataTextField: "MPN_ID",
dataValueField: "MPN_ID",
dataSource: {
type: "odata",
transport: {
read: dsMPNID
}
}
});
}
var dsMPNID = new kendo.data.DataSource({
transport: {
read: {
// the remote service url
url: $.appConfig.ServiceUri + "/GetMPNIDs",
// the request type
type: "odata",
// the data type of the returned result
dataType: "jsonp",
}
},
// describe the result format
schema: {
// the data, which the data source will be bound to is in the "list" field of the response
data: "MPN_ID"
}
});
dsPartnerGrid = new kendo.data.DataSource({
serverFiltering: true,
serverPaging: true,
serverSorting: true,
autoBind: false,
batch: false,
autoSync: true,
pageSize: 30,
schema: {
model: {
id: "MPN_ID",
fields: {
"MPN_ID": { type: "string", editable: true, validation: { required: true } },
}
}
},
type: "odata",
transport: {
read: {
url: $.appConfig.ServiceUri + "/GPLs",
dataType: "jsonp"
}
},
requestEnd: function (e) {
if (typeof (e.response) == 'undefined')
return;
if (e.response == null)
return;
if (typeof (e.response.d) == 'undefined')
return;
if (e.response.d.length == 0)
return;
}
})
$("#partnerGrid").kendoGrid({
dataSource: dsPartnerGrid,
pageable: true,
height: 550,
//filterable: {
// mode: "row"
//},
toolbar: ["create"],
columns: [
{ command: ["edit", "destroy"], title: " ", width: "150px" },
{ field: "MPN_ID", title: "MPN_ID", width: "150px", editor: mpnDropDownEditor, template: "#=Mpn.MPN_ID#"},
],
editable: "inline"
});