Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
141312 | Dec 5,2018 03:23 PM UTC | Dec 19,2018 11:01 AM UTC | ASP.NET MVC - EJ 2 | 7 |
![]() |
Tags: Grid |
@{
ViewBag.Title = "Grid Sample";
}
<div>
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).AllowPdfExport().PdfQueryCellInfo("PdfQueryCellInfo").
ExcelQueryCellInfo("ExcelQueryCellInfo").AllowExcelExport().ToolbarClick("toolbarClick").Columns(col =>
{
...
col.HeaderText("TemplateColumn").Width("150").Template("#template").Add();
}).AllowPaging().PageSettings(page => page.PageSize(8)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true)
.Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel", "ExcelExport", "PdfExport" }).Render()
</div>
<script id="template" type="text/template">
<div>
${ShipCountry}, ${ShipCity}
</div>
</script>
<script>
function toolbarClick(args) {
var gridObj = document.getElementById("Grid").ej2_instances[0];
if (args.item.id === 'Grid_excelexport') {
gridObj.excelExport();
} else if (args.item.id === 'Grid_pdfexport') {
gridObj.pdfExport();
}
}
function ExcelQueryCellInfo(args) {
if (args.value.length === 0) {
args.value = args.data.ShipCountry + ", " + args.data.ShipCity;
}
}
function PdfQueryCellInfo(args) {
if (args.value.length === 0) {
args.value = args.data.ShipCountry + ", " + args.data.ShipCity;
}
}
</script> |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.