EJ2 Grid: Excel Export Aggregate Row, Change Background Color

Hello, 

Given a regular grid that has grouping, how do I change the background color of that row on Excel Export?  The following code does not work (meaning the original grey stays even though when you dump to console, the value has changed to yellow), but I can change the one cell that has the aggregate total.


excelAggregateQueryCellInfo: function (args){
                    console.log(args);
                    args.row.attributes.class = "";
                    args.style.style.backColor = '#FFFF00'; //This will change just the one cell
                    args.row.cells.forEach(function(row){
                        row.attributes.class = "";
                        row.attributes.style = {//Does not work
                            backColor: '#FFFF00',
                            fontSize: 13,
                        };
                        row.style = { //Does not work
                            backColor: '#FFFF00',
                            fontSize: 13,
                        };
                    });
                },

2 Replies

AI Aijda September 19, 2022 08:50 AM UTC

Sports betting can be very profitable if you find a good bookmaker with a good reputation and a large fan base. I found https://parimatch.in/en/cricket/t10-league-c52852bbdf524b379595d612e1309823/prematch for myself. This is my favorite betting site because they are very reliable and guarantee safety. Money can be withdrawn very easily and instantly. In general, it is worth paying attention to you.




RS Rajapandiyan Settu Syncfusion Team September 19, 2022 02:04 PM UTC

Hi Mark,


Thanks for contacting Syncfusion support.


The excelAggregateQueryCellInfo event is used to customize the particular aggregate cell. If you want to customize the whole caption row, you can achieve this by using the theme of excelExportProperties. Find the below documentation for more information.


Theme – excelExportProperties: https://ej2.syncfusion.com/javascript/documentation/grid/excel-export/excel-cell-style-customization/#theme


[index.js]

grid.toolbarClick = function (args) {

  if (args.item.id === 'Grid_excelexport') {

    var excelExportProperties = {

      theme: {

        caption: { backColor: '#FFFF00' }, // customize the theme for caption row

      },

    };

    grid.excelExport(excelExportProperties);

  }

};

 


Sample: https://stackblitz.com/edit/xptfsr?file=index.js

Please get back to us if you need further assistance.


Regards,

Rajapandiyan S
If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Loader.
Up arrow icon