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

How to change a row's background-color or color comparing pieces of information

Thread ID:





130096 Apr 21,2017 07:54 AM UTC Apr 24,2017 06:45 AM UTC JavaScript 1
Tags: ejGrid
Daniel Pujante
Asked On April 21, 2017 07:54 AM UTC


I've been whaching the example you show on:


This example is just I need, but selecting the whole line instead.

I've being seeing concretely this:

           queryCellInfo: function (args) {
                    if (args.column !== undefined && args.column.field === "unitPrice") {
                        var $element = $(args.cell);
                        if (Globalize.parseFloat(Globalize.format(args.text, "c")) < 30) {
                            $element.css("background-color", "#b0e98f").css("color", "black");
                        else {
                            $element.css("background-color", "#f4a496").css("color", "black");

I'd would like the same but selecting the whole line instead a cell, could you give me a example, I would be very grateful.

Thank you very mach


Daniel Pujante

Prasanna Kumar Viswanathan [Syncfusion]
Replied On April 24, 2017 06:45 AM UTC

Hi Daniel, 

Thanks for contacting Syncfusion support. 

To change the row background color, use rowDataBound event of ejGrid. This event will be triggered every time a request is made to access row information, element and data. In this event we can get the row element in the arguments and change the background color according to the value of unitPrice. 

Find the code example and sample:  

                dataSource: window.details, 
                enableRowHover: false, 
                allowSelection: false, 
                columns: [ 
                rowDataBound: function (args) { 
                        var $element = $(args.row); 
                        if (args.data.unitPrice < 30) { 
                            $element.css("background-color", "#b0e98f").css("color", "black"); 
                        else { 
                            $element.css("background-color", "#f4a496").css("color", "black"); 

Refer to the Help document for the rowDataBound event.  

Prasanna Kumar N.S.V 


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