<ejs-grid id="Grid" dataSource="@ViewBag.data" queryCellInfo="dropdown">
<e-grid-columns>
<e-grid-column headerText="Order Status" width="200" template="#dropdown"></e-grid-column>
. . .
</e-grid-columns>
</ejs-grid>
<div id='dropdown'>
// initializing with unique id. OrderID is a column name
<input id="combo${OrderID}">
</div>
<script>
function dropdown(args) {
var ele = args.cell.querySelector("#combo"+args.data["OrderID"]);
var drop = new ej.dropdowns.ComboBox({
dataSource: sportsData,
autoFill: "true",
fields: { value: 'Game' },
placeholder:"Choose data type"
});
drop.appendTo(ele);
}
</script>
|
<ejs-grid id="Grid" dataSource="@ViewBag.data" queryCellInfo="dropdown">
<e-grid-columns>
...
</e-grid-columns>
</ejs-grid>
<div id='dropdown'>
<input id="combo${OrderID}">
</div>
<script>
function dropdown(args) {
var ele = args.cell.querySelector("#combo"+args.data["OrderID"]);
var drop = new ej.dropdowns.ComboBox({
dataSource: @Html.Raw(Json.Serialize(@ViewBag.combodata)), //resolve the reported problem by serialize the data like this
autoFill: "true",
fields: { value: 'Game' },
placeholder:"Choose data type"
});
drop.appendTo(ele);
}
</script>
|