jQWidgets Forums

jQuery UI Widgets Forums Grid Grid Cell background color

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 12 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Grid Cell background color #16722

    taraman
    Member

    hi,
    I need to assign a color for the background of a cell based on a certain value:
    -ve => cell background will be in red
    +ve => cell background will be in green

    I have check the following code on demo, to color the text. But I need to color the cell background:

    var cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties) {
    if (value < 20) {
    return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + '; color: #ff0000;">' + value + '</span>';
    }
    else {
    return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + '; color: #008000;">' + value + '</span>';
    }
    }
    Grid Cell background color #16728

    Peter Stoev
    Keymaster

    Hi taraman,

    If you want to have a custom cell background, you may need to use a DIV tag with width=”100%” and height=”100%”. The DIV tag’s style should define the cell’s background.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.