@(Html.EJ().Grid<Object>("FlatGrid")
………………………………………….
.ClientSideEvents(eve => { eve.ActionComplete("complete"); })
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.InlineFormTemplate).InlineFormTemplateID("#template"); })
……………..
.Columns(col =>
{
col.Field("ShipCity").HeaderText("ShipCity").EditType(EditingType.DropdownEdit).IsPrimaryKey(true).Width(80).Add();
col.Field("CustomerID").Visible(false).Add();
col.Field("Freight").HeaderText("Qty").TextAlign(TextAlign.Right).Width(75).Add();
col.Field("ShipCountry").HeaderText("Cost").TextAlign(TextAlign.Right).Width(75).Add();
}))
<script id="template" type="text/template">
<table cellspacing="10">
<tr>
<td>ShipCity</td>
<td>
<input type="text" id="ShipCity" name="ShipCity" value="{{:ShipCity}}" />
</td>
</tr>
<tr>
<td>Freight</td>
<td>
<input type="text" id="Freight" name="Freight" value="{{:Freight}}" />
</td>
</tr>
<tr>
<td>ShipCountry</td>
<td>
<input type="text" id="ShipCountry" name="{{:ShipCountry}}" />
</td>
</tr>
</table>
</script>
<script>
function complete(args) {
$("#ShipCountry").ejNumericTextbox();
$("#Freight").ejNumericTextbox();
$("#ShipCity").ejDropDownList({ enableFilterSearch: true, width: "100%", dataSource: window.gridData, fields: { text: "ShipCity", value: "ShipCity" } }); // render the html element to a desire jscontrol here.
}
</script>
|