What is the correct way to populate a grid that has a dropdown edit.
When i put the value as the populated value it displays the value, not the text (when editing it defaults to the right value, just doesn't display it). When i use the text, when editing it defaults to the first dropdown choice.
var dateUnit = [{ text: "hours", value : 1}, {text: "days", value: 2}];
$("#Grid").ejGrid({
dataSource: data,
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
editSettings: { allowEditing: true, allowAdding: true },
allowSelection: false,
columns: [
{ field: "Id", isPrimaryKey: true, headerText: "ID", width: 80, textAlign: ej.TextAlign.Center },
{ field: "Age", headerText: 'Age', width: 80, textAlign: ej.TextAlign.Center },
{ field: "Unit", headerText: "Unit", textAlign: ej.TextAlign.Center, editType: "dropdownedit", dataSource: dateUnit, defaultValue: 2 }
],
actionComplete: function (args) {
if (args.requestType == "add") {
var drpdwn = this.getContentTable("#detailGrid").find("#detailGridUnit").ejDropDownList("instance");
console.log(drpdwn);
drpdwn.setSelectedValue(2);
}
}
});