|
[Index.cshtml]
@{
List<object> toolbarItems = new
List<object>();
toolbarItems.Add("PdfExport");
toolbarItems.Add("ExcelExport");
toolbarItems.Add(new { text: 'WizAdd',
tooltipText: 'Wizard Add',
prefixIcon: 'e-export',
id: 'WizardAdd',});
}
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.DataSource).ToolbarClick("toolbarClick").Columns(col
=>
{
col.Field("OrderID").HeaderText("Order
ID").IsPrimaryKey(true).Width("120").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("Freight").HeaderText("Freight").Width("120").EditType("numericedit").Format("C2").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("ShipName").HeaderText("Ship
Name").Width("150").Add();
col.Field("ShipCountry").HeaderText("Ship
Country").Width("150").EditType("dropdownedit").Add();
}).AllowPaging().PageSettings(page =>
page.PageCount(2)).Toolbar(toolbarItems).Render()
<script>
var
toasts = [
{
title: 'Information !',
content: 'Please read the comments carefully.',
cssClass: 'e-toast-info',
click: onClick,
},
];
let
toast = new Toast({
position: { X: 'Right', Y: 'Bottom' },
});
toast.appendTo('#element');
function
onClick(e) {
e.clickToClose = true;
}
function toolbarClick(args) {
if (args.item.id === 'WizardAdd') {
toast.show(toasts[0]);
} }
</script>
|