Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
igx-grid pinned column values are not getting exported
posted

Hi Team, 

We are currently using igx version 14.2.17 . we are using multiheader grid we are pinning the columns when i try to export the grid . pinned column values are not getting exported. Could you please help me in this.

Thanks

Vijay

Parents
  • 460
    Offline posted

    Hello Vijay,

    I have been looking into your question and by default with Excel Export enabled feature igx-grid component always exports the pinned columns. In your case with the multi-column headers in the grid, what I assume is that the multi-column headers themselves are not exported.

    To enable the export of the multi-column headers, what you need to do is to handle the exportStarted event of the igx-grid-toolbar-exporter component, and in the given function you will set the ignoreMultiColumnHeaders option to false when exporting to export the multi-column headers as well.

    <igx-grid #grid height="600px" [data]="data">
         <igx-grid-toolbar>
           <igx-grid-toolbar-actions>
             <igx-grid-toolbar-exporter
               [exportExcel]="true"
               (exportStarted)="exportStarted($event)"></igx-grid-toolbar-exporter>
           </igx-grid-toolbar-actions>
         </igx-grid-toolbar>
    </igx-grid>

    public exportStarted(args: IgxExporterEvent) {
             args.options.ignoreMultiColumnHeaders = false;
    }

    However, I have created a small sample trying to reproduce the described behavior. I am using igx-grid component with Excel Export feature enabled. I also use multi column headers and Pinning feature enabled. On my side everything works as expected and I am able to pin a given multi-column header column and then export the grid to excel. The result is that all the columns along with the pinned column are exported and I can see all the values in the columns. I am testing the sample in your version of Ignite UI Angular ^14.2.x as well as in the latest version of Ignite UI Angular ^15.0.x and everything works as expected.

    The described scenario could be observed here:

    Here you will find my sample for your reference. Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated, please feel free to provide your own sample.

    Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior. 

    If you require any further assistance on the matter, please let me know.

    Regards,

    Georgi Anastasov

    Entry Level Software Developer

    Infragistics

Reply
  • 460
    Offline posted in reply to Vijay Velchamy

    Hello,

    Thank you for the provided sample.

    I have been looking into your question and the reason the igx-grid component cannot be exported to an excel file in the given sample is the use of the formatter property of the igx-column component for the date type column to format and change the date. The reason is not in the grouping and in the group by feature itself, but when changing the dates for all cells in the given column with formatter property, the export cannot be performed because the date and format itself are completely modified.

    What I could suggest as an approach is if you don't have date type columns just put the groupable property on all other columns and set it to true to implement and take advantage of the group by feature which will fully work with pinning and multi-column headers. On the other hand, if you have date type columns and you don't need any formatting you can remove the formatter property of the igx-column component and again before and after grouping the grid will export to an excel file as expected.

    Finally, if you actually have a date type column and need some formatting for the dates in the cells of the column you can use the ng-template element with the igxCell directive so you can take the value of each cell and apply a pipe to format the cell value.

    <igx-column field="OrderDate" header="Order Date" [groupable]="true">
               <ng-template igxCell let-cell="cell" let-val>
                                   {{val | date:'dd/MM/yyyy'}}
               </ng-template>
    </igx-column>

    The described scenario could be observed here:

     

    In addition, I have prepared small sample illustrating this behavior which could be found here. Please test it on your side and let me know how it behaves.

    I have also made an additional sample for your reference in which I have implemented together multi-column headers, pinning feature and grouping feature along with exporting to excel which works as expected as this described behavior can be found here.

    Thank you for your cooperation.

    Regards,

    Georgi Anastasov

    Entry Level Software Developer

    Infragistics

Children