@Html.EJS().Grid("Grid").DataSource(ds => ds.Url("/Home/UrlDatasource").Adaptor("UrlAdaptor").InsertUrl("/Home/Insert").RemoveUrl("/Home/Remove")
.UpdateUrl("/Home/Update")).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").Width("120").IsPrimaryKey(true).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
. . . .
}).Height("400").AllowExcelExport().AllowPaging().AllowFiltering(true).AllowGrouping().AllowSorting().FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Menu); }).ToolbarClick("toolbarClick").Toolbar(new List<string>
() { "ExcelExport" }).Render()
</div>
<script>
function toolbarClick(args) {
var gridObj = document.getElementById("Grid").ej2_instances[0];
if (args.item.id === 'Grid_excelexport') {
var query = gridObj.renderModule.data.generateQuery(true);
// execute the action queries in getDataModule.
gridObj.getDataModule().executeQuery(query).then((e) => {
console.log(e.result); // you can retrieve the all data after filter and grouping
})
gridObj.excelExport();
}
}
</script>
|
var query = gridObj.renderModule.data.generateQuery(true);
// execute the action queries in getDataModule..
new ej.data.DataManager({url:"gr"}).executeQuery(query).then((e) => {
console.log(e.result); // you can retrive the all data after filter and grouping
}).catch((e) => {
console.log(e.error);
}); |