@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
---------
.ClientSideEvents(clienevent => clienevent.ActionComplete("complete"))
.Columns(col =>
{
-----
col.Field("ShipCountry").HeaderText("Ship Country").TextAlign(TextAlign.Right).Width(75).Add();
}))
<script type="text/javascript">
var data = [
{ id: "1", text: "FRANCE" },
{ id: "2", text: "GERMANY" },
{ id: "3", text: "BRAZIL" },
{ id: "4", text: "BELGIUM" },
{ id: "5", text: "MEXICO" }
];
function complete(args) {
if (args.requestType == "add") {
$("#" + this._id + "ShipCountry").ejDropDownList( {
dataSource: data,
field: { text: "text", value: "text" },
width: "100%"
});
}
}
</script>
|
@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.EditSettings(edit => edit.AllowAdding().AllowDeleting().AllowEditing())
----
.ClientSideEvents(clienevent => clienevent.ActionComplete("complete"))
.Columns(col =>
{
-----
col.Field("ShipCountry").HeaderText("Ship Country").TextAlign(TextAlign.Right).Width(75).Add();
}))
</div>
<script type="text/javascript">
var data = [
{ id: "1", text: "FRANCE" },
{ id: "2", text: "GERMANY" },
{ id: "3", text: "BRAZIL" },
{ id: "4", text: "BELGIUM" },
{ id: "5", text: "MEXICO" }
];
function complete(args) {
if (args.requestType == "add" || args.requestType == "beginedit") { // set dropdown list for the requestType beginedit also
$("#" + this._id + "ShipCountry").ejDropDownList({ dataSource: data, field: { id: "id", text: "text", value: "text" }, width: "100%" })
}
}
</script>
|