Search results

Drill Through in ASP.NET MVC Pivot Grid control

21 Oct 2021 / 1 minute to read

Allows the user to view the detailed data or an original values of the summarized cell of the pivot table. It can be enabled by setting the allowDrillThrough property to true. On double clicking any value cell, you can view detailed report in new window. In this reports, user can get the row and column headers and summary value(measure) of the clicked cell. Also, user can include/exclude the fields which available in the data source using column chooser option. By default, detailed reports showing for bounded fields in the pivot report.

razor
DrillThrough.cs
Copied to clipboard
@Html.EJS().PivotView("PivotGrid").Width("100%").Height("300").DataSource(dataSource => dataSource.Data((IEnumerable<object>)ViewBag.Data).ExpandAll(false).EnableSorting(true)
    .FormatSettings(formatsettings => 
    { 
        formatsettings.Name("Amount").Format("C0").MaximumSignificantDigits(10).MinimumSignificantDigits(1).UseGrouping(true).Add(); 
    }).Rows(rows => 
    { 
        rows.Name("Country").Add(); rows.Name("Products").Add(); 
    }).Columns(columns => 
    { 
        columns.Name("Year").Caption("Production Year").Add(); columns.Name("Quarter").Add(); 
    }).Values(values => 
    { 
        values.Name("Sold").Caption("Units Sold").Add(); values.Name("Amount").Caption("Sold Amount").Add(); 
    })).AllowDrillThrough(true).Render()
Copied to clipboard
public ActionResult Index()
{
    var data = GetPivotData();
    ViewBag.data = data;
    return View();
}