<ej-grid id="FlatGrid" allow-paging="true" datasource="ViewBag.datasource" allow-filtering="true" template-refresh="refresh">
<e-columns>
<e-column header-text="Template" template="#columnTemplate" width="75" field="EmployeeID"></e-column>
<e-column field="OrderID" header-text="Order ID" is-primary-key="true" text-align="Right" width="75"></e-column>
. . .
</e-columns>
</ej-grid>
<script type="text/x-jsrender" id="columnTemplate">
<div><input id='dropdown{{:EmployeeID}}'></div>
</script>
<script type="text/javascript">
function refresh(args) {
var data = @Html.Raw(Json.Serialize(ViewBag.datasource1))
$(args.cell).find("#dropdown" + args.rowData.EmployeeID).ejDropDownList({ width: 150, dataSource: data, fields: { text: "text", value: "value" } });
}
</script>
Serverside:-
public ActionResult Index()
{
bike.Add(new Bikes { empid = "bk1", text = "Apache RTR" });
bike.Add(new Bikes { empid = "bk2", text = "CBR 150-R" });
bike.Add(new Bikes { empid = "bk3", text = "CBZ Xtreme" });
bike.Add(new Bikes { empid = "bk4", text = "Discover" });
bike.Add(new Bikes { empid = "bk5", text = "Dazzler" });
ViewBag.datasource1 = bike;
return View();
}
|