@(Html.EJ().Grid<Object>("Grid")
----
.ClientSideEvents(eve => eve.ActionComplete("complete")); })
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(80).Add();
col.Field("EmployeeID").HeaderText("Employee ID").EditType(EditingType.DropdownEdit).Width(90).Add();
col.HeaderText("Template").Template("#columnTemplate").Width(100).Add();
})
)
<script>
function complete(args) { // actioncomplete event
if (args.requestType == "beginedit" || args.requestType == "add") {
$("#GridEmployeeID").ejDropDownList({ // dropdown
change: function (args) { // change event of dropdown
var inst = $(".e-grid").data("ejGrid");
var index = inst.selectedRowsIndexes;
if (args.value == 1) {
// changing type and value of template
$(".e-rowcell.e-templatecell").eq(0).find("input")[index[0]].type = "text";
$(".e-rowcell.e-templatecell").eq(0).find("input")[index[0]].value = "jkj";
}
if (args.value == 2) {
-------
}
if (args.value == 3) {
-----
}
}
})
}
}
|