|
@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
. . . . . . .
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).AllowEditing(false).Width(75).Add();
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).AllowEditing(false).Format("{0:C}").Add();
col.Field("ShipCity").HeaderText("Ship City").Width(110).Add();
}))
</div>
<script>
function onLoad() {
this.model.keySettings = { moveCellRight: "13", saveRequest: " " };
}
</script>
|
|
@(Html.EJ().Grid<object>("FlatGrid")
. . . . . . .
.ClientSideEvents(e => e.Load("onLoad").CellEdit("edit").CellSave("save"))
. . . . . .
}))
</div>
<script>
function edit() {
if (args.cell.index() == 2) // to prevent the next cell (2nd) from editing
args.cancel = true;
}
function save() {
if (args.cell.index() == 1) {
var proxy = this;
var arg = args;
setTimeout(function () {
proxy.editCell(arg.cell.closest("tr").index(), proxy.getColumnByIndex(5).field);
}, 0)
}
}
function onLoad() {
this.model.keySettings = { moveCellRight: "13", saveRequest: " " };
}
</script>
|