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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

When i change the cell background color the cell does not highlight when the mouse hovers over it

Thread ID:





129324 Mar 13,2017 10:04 AM UTC Mar 14,2017 12:20 PM UTC ASP.NET MVC 1
Tags: Grid
Andrew Simpson
Asked On March 13, 2017 10:04 AM UTC

i am using the querycellinfo clientsideevent to change the background color of a cell to red

 function querycellinfo(args) {
args.cell.style.backgroundcolor = "red";

however when i do that the cell does not highlight when the mouse hovers over it.
how can i change the background color without losing the css for the mouse hover.
or change the css for the cell back to the default values for the mouse hover


Saravanan Arunachalam [Syncfusion]
Replied On March 14, 2017 12:20 PM UTC

Hi Andrew, 
Thanks for contacting Syncfusion’s support. 
We understood from your query, you need to toggle the hover style on the customized cell (by queryCellInfo event) when mouse hovering on the Grid’s rows and we have achieved it by using dataBound event of ejGrid control. In dataBound event, we have bound the jQuery’s mouseenter and mouseleave event to cell elements in the Grid for toggle the hover css on customized cell. Please refer to the below code example and jsplayground sample. 
            background-color: red; 
                dataSource: data, 
                allowPaging: true, 
                queryCellInfo: function(args){ 
                    var val = ej.getObject("Freight", args.data); 
                    if(args.column.field == "Freight" && val>50 && val<100) 
                       $(args.cell).addClass("red"); //Change the background color of cell 
                dataBound: function(args){ 
                    var proxy = this; 
                    this.getContent().find("tr td").on("mouseenter mouseleave", function(e){ 
                        ele = $(e.target).closest("tr").find("td.red"); 
                        if(e.type == "mouseenter") 
                            ele.removeClass("red").addClass("normal"); //remove red and add normal class when hover mouse                      
                    this.getContent().find("tr td").on("mouseleave", function(e){  
                         ele = $(e.target).closest("tr").find("td.normal"); 
                         if(e.type == "mouseleave") 
                            ele.addClass("red").removeClass("normal"); //remove normal and add red class when leave mouse   
                . . . 
Saravanan A. 


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