@Html.EJS().Grid("DefaultFunctionalities").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col=> {
col.Field("OrderID").HeaderText("Order ID").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Width("120").Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("150").Add();
col.Field("OrderDate").HeaderText("Order Date").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Width("130").Format("yMd").Add();
col.Field("Freight").HeaderText("Freight").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Width("120").Format("C2").Add();
col.Field("ShippedDate").HeaderText("Shipped Date").Width("140").Format("yMd").Add();
col.Field("ShipCountry").HeaderText("Ship Country").Width("150").Add();
}).AllowPaging().PageSettings(page=>page.PageCount(5)).Render()
|
<div>
@Html.EJS().Grid("Grid").Load("load" ).DataSource((IEnumerable<object>)ViewBag.datasource).Columns(col =>
{
...
col.Field("ShippedDate").HeaderText("Ship Date").Width("150").Add();
}).AllowPaging().EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }).Render()
<script>
function load(args) {
//Here OrderDate is the 3rd column
this.columns[3].format = { type: 'date', format: 'dd/MM/yyyy' };
}
</script>
|
@Html.EJS().Grid("Format").DataSource((IEnumerable<object>)ViewBag.DataSource).Columns(col =>
{
..
. . .
col.Field("OrderDate").HeaderText("Order Date").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Type("date").Add();
Render() script >
function load(args ) {
this.columns[2].format = {type: ‘date’: format: ‘dd/MM/yyyy’}
}
script > |