@(Html.EJ().Grid<Object>("Grid")
.Datasource((IEnumerable<object>)ViewBag.DataSource)
.AllowPaging()
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) //Enable the editsettings(inline editing)
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items => //Toolbar items
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.Columns(col =>
{
col.Field("SNO").IsPrimaryKey(true).Add();
col.Field("quantity").Add();
col.Field("Price").Add();
col.HeaderText("Calories In Take").Template("<span>{{:quantity * Price }}</span>").Add(); //Template column and we have calculated the values from price and quantity column
})
) |
|
@(Html.EJ().Grid<Object>("Grid")
.Datasource((IEnumerable<object>)ViewBag.DataSource)
.AllowPaging()
. . .
.ClientSideEvents(e=>e.TemplateRefresh("templateRefresh"))
.Columns(col =>
{
col.Field("SNO").IsPrimaryKey(true).Add();
col.Field("quantity").Add();
col.Field("Price").Format("{0:C}").Add();
col.HeaderText("Total").Template("{{:quantity * Price }}").Add(); //Template column and we have calculated the values from price and quantity column
})
)
<script>
function templateRefresh(args) {
if (args.cell.innerHTML.split("$").length == 1)
args.cell.innerHTML = "$" + args.cell.innerHTML; //here we can apply the currency format
}
</script> |
@(Html.EJ().Grid<Object>("Grid")
.Datasource((IEnumerable<object>)ViewBag.DataSource)
.AllowPaging()
. . .
.Columns(col =>
{
col.Field("SNO").IsPrimaryKey(true).Add();
col.Field("quantity").Add();
col.Field("Price").Format("{0:C}").Add();//here we can applying the currency format for price column.
col.HeaderText("Total").Template("{{:quantity * Price }}").Add(); //Template column and we have calculated the values from price and quantity column
})
)
|
DLLs |
Syncfusion.EJ.dll
Syncfusion.EJ.Mvc.dll |
Script files |
Syncfusion script files:
ej.web.all.min.js
External Script files:
jquery.min.js
jsrender.min.js
jquery.validate.min.js |
CSS files |
ej.web.all.min.css |
[web.config]
<compilation debug="true" targetFramework="4.5" >
<assemblies>
<add assembly="Syncfusion.EJ, Version= XX.XXXX.X.XX, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
<add assembly="Syncfusion.EJ.Mvc, Version= XX.XXXX.X.XX, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
</assemblies>
</compilation> |