Hi team,
I am using Infragistics version 9.1.28 and will update in upcoming month but this is requirement i have to deliver.Requirement: Using Hierarchical Grid load on demand feature. We need to export Data to excel with both parent and child grid data in same Hierarchal format. Please provide a data format to achieve export to excel feature with hierarchal format
Hello Shobhana,
Thank you for following up!
I have looked into your clarifications and what I could suggest, as mentioned in our documentation here, is using the exportData method of the IgxExcelExporterService and providing the data information received from the API.
However, this approach will not export the data in a hierarchical format as the format is based on the structure and data of the IgxHierarchicalGrid and, as previously mentioned, in order for the Excel Export Service to export the parent and child grids in the appropriate hierarchical format, this information should be available in the data property of the IgxHierarchicalGridComponent.
Nevertheless, I have tried preparing a small sample where I am using the abovementioned exportData method in order to export the whole data collection and modified it in order to have a hierarchical-like format.
Additionally, the exported content could be further customized via the rowExporting and columnExporting events and I believe that you will find our Customizing the Exported Content section here quite helpful.
Here could be found my sample for your reference. Please test it on your side and let me know if you need any further assistance regarding this matter.
Looking forward to your reply.
Sincerely, Riva Ivanova Associate Software Developer
Can you please reply ASAP.
Hello Riva,Thank you for repkying.Although we are using Load on demand feature of Hierarchal grid, but we have a seperate API that will contain both parent and child Data.Data Model for Export to Excel :
[ { "ParentData": { "CustomerID": "string", "CompanyName": "string", "ContactName": "string", "CountryTitle": "string", "Country": 0
}, "childData": [ { "orderID": 0, "CustomerID": "string", "shipCountry": "string", "shipCity": "string" } ] } ]
Requirement: On export to excel, i want the data to be exported in Hierarichal format as it displays in the Grid.
Thank you for posting in our community!
I have been looking into your question, however, please note that according to our support policy version 9.1.28 is considered retired and is no longer eligible for Developer Support Services.
Having this in mind, I would suggest updating your application and using any of the currently supported versions of Ignite UI for Angular, which are 14.2.x and 15.1.x, in order to take advantage of all new features, functionalities, and developer support. For more information, you can refer to our official Update guide.
Additionally, regarding your question, what I could say is that in order the Excel Export Service to export the parent and child grids in the appropriate hierarchical format, this information should be available in the data property of the IgxHierarchicalGridComponent
this.excelExportService.export(this.hierarchicalGrid, new IgxExcelExporterOptions('ExportedDataFile'));
or exporting the whole data collection
this.excelExportService.exportData(this.localData, new IgxExcelExporterOptions('ExportedDataFile'));
Furthermore, when using the load on demand functionality initially only the root grid’s data is retrieved and rendered, and only after the user expands a row containing a child grid, the data for that particular child grid will be received. However, at this point the data property of the IgxHierarchicalGridComponent has information only for its root grid data and not for the child grids, depending on how the load on demand functionality is implemented. Having this in mind, even after expanding the child grids, the exported Excel file will contain information only for the root grid.
A possible approach is using the gridCreated event and setting the retrieved child grid data to the collection in the parent which corresponds to the key property of the child grid. This, however, will require the child grid to be expanded in order for the data to be retrieved.
Here could be found a small sample demonstrating this approach.
Please let me know if you need any further assistance regarding this matter.