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. Image for the cookie policy date

Different header backgrounds

I would like to color code columns based of the grouping.  I am able to format the cells properly by using customAttributes and css class, but can't seem to do it on the headers and the group header.  Is it possible?



3 Replies

PS Pavithra Subramaniyam Syncfusion Team September 2, 2019 08:53 AM UTC

Hi Jacob, 
 
Thanks for contacting Syncfusion support. 
 
You can achieve your requirement by using the “customAttributes” property to both stacked header column and inner columns. Please refer to the below code example and sample link for more information. 
 
[index.js] 
var grid = new ej.grids.Grid({ 
        dataSource: window.orderData, 
        allowPaging: true, 
        allowResizing: true, 
        pageSettings: { pageCount: 5 }, 
        columns: [ 
            { field: 'OrderID', headerText: 'Order ID', textAlign: 'Right', width: 120, minWidth: 10 }, 
            { 
                headerText: 'Order Details', customAttributes: { class: 'e-attr' }, columns: [ 
                    { field: 'OrderDate', headerText: 'Order Date', textAlign: 'Right', width: 135, format: 'yMd', minWidth: 10, customAttributes: { class: 'e-attr' } }, 
                    { field: 'Freight', headerText: 'Freight($)', textAlign: 'Right', width: 120, format: 'C2', minWidth: 10, customAttributes: { class: 'e-attr' } }, 
                ] 
            }, 
            .  .   . 
        ] 
    }); 
    grid.appendTo('#Grid'); 
 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 



JB Jacob Bohrtz September 3, 2019 01:35 PM UTC

Sample worked...thanks! 


TS Thavasianand Sankaranarayanan Syncfusion Team September 4, 2019 05:35 AM UTC

Hi Jacob, 
 
Thanks for your update. 
 
We are happy that the problem has been resolved at your end. 
 
Regards, 
Thavasianand S.  


Loader.
Up arrow icon