@(Html.EJ().Grid<Object>("FlatGrid")
…………………………………………………………
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Add();
col.Field("CustomerID").HeaderText("Customer ID").Add();
col.Field("Amount").HeaderText("Amount").DefaultValue(0).Add();
col.Field("Freight").HeaderText("Freight").EditType(EditingType.NumericEdit).DefaultValue(45).Add();
col.Field("ShipCountry").HeaderText("Ship Country").DefaultValue("Brazil").Add();
})) |
@(Html.EJ().Grid<Object>("FlatGrid")
………………………………………………
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Type("number").Add();
col.Field("CustomerID").HeaderText("Customer ID").EditType(EditingType.StringEdit).Type("string").Add();
col.Field("Freight").HeaderText("Freight").Type("number").Add();
col.Field("ShipCountry").HeaderText("Ship Country").Type("string").Add();
col.Field("OrderDate").HeaderText("Order Date").EditType(EditingType.Datepicker).Type("date").Format("{0:MM/dd/yyyy}").Add();
}))
|
@(Html.EJ().Grid<Object>("FlatGrid")
………………………………………………………………………
.ClientSideEvents(e=>e.BeforeBatchSave("BeforeBatchSave"))
.Columns(col =>
{
……………………………………………………….
}))
<script>
function BeforeBatchSave(args) {
if (ej.isNullOrUndefined(args.batchChanges.added[0].Freight)) {
args.batchChanges.added[0].Freight = 0; // set the value here.
}
}
</script> |