@{
List<object> toolbarItems = new List<object>();
toolbarItems.Add("Search");
toolbarItems.Add(new { text = "Expand All", tooltipText = "Expand All", prefixIcon = "e-expand", id = "expandall" });
toolbarItems.Add(new { text = "Collapse All", tooltipText = "Collapse All", prefixIcon = "e-collapse", id = "collapseall", align = "Right" });
}
@Html.EJS().Grid("Grid")..
. . .
.Toolbar(toolbarItems).Render()
|
@{
List<object> toolbarItems = new List<object>();
. . .
toolbarItems.Add(new { text = "<", tooltipText = "Last Week", id = "lastweek", align = "Center" });
}
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).ToolbarClick("toolbarClick").Columns(col =>
{
. . .
}).AllowPaging().PageSettings(page => page.PageCount(2)).Toolbar(toolbarItems).Render()
<script>
function toolbarClick(args) {
if (args.item.id === 'lastweek') {
alert("ok");
}
if (args.item.id === "nextweek") {
alert("ok2");
}
}
</script> |