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

Cell background color change on row selection

Hello,

I need your help.

I want some cells in grid to have different background color (to be somehow highlighted). So on queryCellInfo event, I change background color of particular cell with args.cell.bgColor = "#ffe0e0".
On row hoover event, background color of row changes, but those highlighted cells keep that color (#ffe0e0). [5th row on image]
But when row is selected, whole row background color changes, including those highlighted cells. [4th row on image] I would like to keep background color  of those cells in case of selection (as it is in the case of hoover). How can I achieve that?



5 Replies

VN Vignesh Natarajan Syncfusion Team May 22, 2019 09:52 AM UTC

Hi Petra,  
  
Thanks for contacting Syncfusion support.   
  
Query: “Cell background color change on row selection  
  
From your query, we understand that you are facing issue while selecting a record which is formatted using queryCellInfo event. We are able to reproduce the reported issue at our end while using bgColor attribute to html element (cell).   
  
Since bgColor is html attribute, it's got over ridded by the css styles applied while selecting a record.  And is it not supported in html5. So, we suggest you apply styles using css property.   
  
Refer the below code example  
  
$(args.cell).css("background-color","orange");   
  
Refer the below screenshot for the output  
  
  
  
Please get back to us if you have further queries.   
  
Regards,  
Vignesh Natarajan.  



PV Petra Visic May 22, 2019 10:50 AM UTC

Thanks for answer.
Unfortunately, the suggested solution does not work. I still get the same behaviour as before (when I was using html attribute).


FS Farveen Sulthana Thameeztheen Basha Syncfusion Team May 24, 2019 04:36 AM UTC

Hi Petra, 

Query#:- Unfortunately, the suggested solution does not work. I still get the same behaviour as before (when I was using html attribute). 
We have checked your reported problem by preparing the sample but we are unable to reproduce your reported issue at our end. Refer to the sample Link: 


We need some additional  information to find the cause of the issue. Share us the following details. 

  1. Complete Grid code example(both in server and client side).
  2. If possible replicate the issue in the above sample and revert us back.
  3. Video demo to replicate the issue.
  4. Exact scenario you have faced the issue.


Regards, 
Farveen sulthana T 





PV Petra Visic May 24, 2019 07:55 AM UTC

Thanks for answer.
Your example works fine.
I managed to solve the problem by setting the background-image property...


MP Manivannan Padmanaban Syncfusion Team May 27, 2019 12:08 PM UTC

Hi Petra,

Thanks for the update.

We are happy to hear that the reported issue was resolved. Please let us know if you need further assistance.

Regards,

Manivannan Padmanaban.
 


Loader.
Live Chat Icon For mobile
Up arrow icon