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
close icon

Changing background color of selected cells in pivotview

Hi,

I use a Angular / Javascript pivotview with multiple cells selection enabled. 

How can i changed the background color of the selected cells ?

     this.pivotGridObj.gridSettings.allowSelection = true;
     this.pivotGridObj.gridSettings.selectionSettings =      { mode: 'Cell', cellSelectionMode: 'Flow', type: 'Multiple' }

I tried to access the grid object directly, but this is always undefined.

  if (this.pivotGridObj.grid !== undefined)
          this.pivotGridObj.grid.queryCellInfo = this.customiseCell;


 customiseCell(args: QueryCellInfoEventArgs) {
     // herefiltering for selected cells only 
       args.cell.classList.add('green-background');
    }




3 Replies

SN Sivamathi Natarajan Syncfusion Team February 11, 2020 08:33 AM UTC

 
Thanks for contacting Syncfusion support. 
 
You can change the background-color of the selected cells in CSS. Kindly check the below code example. 
 
Code Example: 
 .e-cellselectionbackground,.e-selectionbackground,.e-pivotview .e-grid .e-rowsheader.e-selectionbackground,.e-pivotview .e-grid .e-columnsheader.e-selectionbackground { 
              background-color: greenYellow !important; 
            } 
 
 
Meanwhile, we have prepared a sample for your reference. Kindly check the below sample link for your reference.  
 
 
We hope the above sample meets your requirement. 
 
Regards, 
Sivamathi. 



RA Rainer February 13, 2020 08:56 PM UTC

Thank you, that solved my problem


SN Sivamathi Natarajan Syncfusion Team February 14, 2020 08:48 AM UTC

Hi Rainer, 
 
Thanks for the reply. Please get in touch with us if you would require any further assistance.  
 
Regards, 
Sivamathi. 


Loader.
Live Chat Icon For mobile
Up arrow icon