Articles in this section
Category / Section

How to export large amount of data in ASP.NET MVC PivotGrid with JSON export?

1 min read

This KB illustrates that to export large amount of data in PivotGrid with JSON export.

Solution

By default, you can export data from pivot component up to 12,000 JSON records. Meanwhile, you can increase the limit by setting the following required properties in Web.config file with maximum limit.

Web.config

<system.web.extensions> 
    <scripting> 
      <webServices> 
        <jsonSerialization maxJsonLength="2147483647"/> 
      </webServices> 
    </scripting> 
  </system.web.extensions> 
  <appSettings> 
    <add key="aspnet:MaxJsonDeserializerMembers" value="2147483647" /> 
//…. 
<httpRuntime maxRequestLength="1073741824" targetFramework="4.5" /> 
<pages> 
//… 
<system.webServer> 
  <security> 
    <requestFiltering> 
      <requestLimits maxAllowedContentLength="1073741824" /> 
    </requestFiltering> 
  </security> 
  </system.webServer>

 

This code increases the exporting support up to 200,000 records. But, when exporting with styles, the maximum exporting support will be up to 150,000 records. Disabling the exportWithStyle api in the “beforeExport” event provides an option to export up to 200,000 records for all types of exporting (Word, PDF, Excel). Find the following code snippet to disable the exportWithStyle api.

JS (beforeExport event for all platforms)

<script type="text/javascript">
function exporting (args) {
    args.exportWithStyle = false;   // by default it sets as true. It improves performance on exporting huge data when it sets as false.
}
</script>

 

ASP

<ej:PivotGrid ID="PivotGrid1" runat="server">
   <ClientSideEvents  BeforeExport="exporting"/>
</ej:PivotGrid>

 

MVC

@Html.EJ().Pivot().PivotGrid("PivotGrid1").ClientSideEvents(clientSideEvents => clientSideEvents.BeforeExport("exporting"))

 

JS

$("#PivotGrid1").ejPivotGrid({
  //..
 beforeExport: "exporting"
});

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied