We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid excel export without child grids.

Thread ID:

Created:

Updated:

Platform:

Replies:

146579 Aug 8,2019 07:01 PM UTC May 25,2020 08:42 AM UTC ASP.NET Core - EJ 2 5
loading
Tags: DataGrid
pk
Asked On August 8, 2019 07:01 PM UTC

Hi, 

how can I exclude the hierarchy grids of my main grid and export to excel the main one without those child grids?

I'm exporting with custom data, so I'm setting an ExcelExportProperties object to execute the grid.excelExport([thatObject]) and I tryied with hierarchyExportMode: "None" but its not working..

Is there any way to accomplish my request?

thanks

Manivel Sellamuthu [Syncfusion]
Replied On August 9, 2019 09:37 AM UTC

Hi pk, 

Thanks for contacting us. 

Yes. You can achieve your requirement by removing child-Grid from grid Object in beforeExcelExport event and restoring in excelExportComplete complete event of the Grid. 

Please find the below code snippet for more information. 

@{ 
    var SecondChildGrid = new Syncfusion.EJ2.Grids.Grid() 
    { 
. . . 
} 
    }; 
    var ChildGrid = new Syncfusion.EJ2.Grids.Grid() 
    { 
. . . 
}, 
        ChildGrid = SecondChildGrid 
    }; 
} 
 
    <div class="control-section"> 
        <ejs-grid id="HierarchyPrint" dataSource="ViewBag.EmpDataSource" beforeExcelExport="beforeExport" excelExportComplete="exportComplete" childGrid="ChildGrid" toolbarClick="toolbarClick" toolbar="@(new List<string>() {"ExcelExport" })" 
                  allowExcelExport="true"> 
            <e-grid-columns> 
                <e-grid-column field="EmployeeID" headerText="Employee ID" textAlign="Right" width="125"></e-grid-column> 
                <e-grid-column field="FirstName" headerText="Name" width="120"></e-grid-column> 
                <e-grid-column field="Title" headerText="Title" width="170"></e-grid-column> 
                <e-grid-column field="City" headerText="City" format='yMd' textAlign="Right" width="135"></e-grid-column> 
            </e-grid-columns> 
        </ejs-grid> 
    </div> 
 
    <script> 
        function toolbarClick(args) { 
            if (args.item.text === 'Excel Export') { 
                this.excelExport(); 
            } 
        } 
        var childGrid; 
        function exportComplete(args) { 
            this.childGrid = childGrid; 
        } 
        function beforeExport(args) { 
            childGrid = this.childGrid; 
            this.childGrid = null; 
        } 
 
    </script> 


                             https://ej2.syncfusion.com/documentation/api/grid/#excelexportcomplete 

Please get back to us, if you need further assistance. 

Regards, 
Manivel 



pk
Replied On August 12, 2019 06:13 PM UTC

thanks

Pavithra Subramaniyam [Syncfusion]
Replied On August 13, 2019 05:57 AM UTC

Hi pk, 
 
Thanks for your update. 
 
Please get back to us if you need nay further assistance on this. 
 
Regards, 
Pavithra S. 


Nitish
Replied On May 24, 2020 10:28 AM UTC

Hi,

Is there any way to export it with CHILD GRID?

Thanks.


Rajapandi Ravi [Syncfusion]
Replied On May 25, 2020 08:42 AM UTC

Hi Nitish, 
 
Thanks for the update 
 
Query#: Is there any way to export it with CHILD GRID? 
 
Yes, you can export the it with Child Grid. We have already discussed about your requirement in our sample demos. Please refer the below sample demos link and screenshot for more information. 
 

Screenshot: 

 
 
Regards, 
Rajapandi R 


CONFIRMATION

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon