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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Different header backgrounds

Thread ID:





147069 Aug 30,2019 03:35 PM UTC Sep 4,2019 05:35 AM UTC JavaScript - EJ 2 3
Tags: Grid
Jacob Bohrtz
Asked On August 30, 2019 03:35 PM UTC

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?

Pavithra Subramaniyam [Syncfusion]
Replied On 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. 
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' } }, 
            .  .   . 
Please get back to us if you need any further assistance on this. 
Pavithra S. 

Jacob Bohrtz
Replied On September 3, 2019 01:35 PM UTC

Sample worked...thanks! 

Thavasianand Sankaranarayanan [Syncfusion]
Replied On 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. 
Thavasianand S.  


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