jQuery UI Widgets Forums Grid Cell margins don't show on right and bottom

This topic contains 2 replies, has 2 voices, and was last updated by  msalvatore 10 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • msalvatore
    Participant

    Hello,

    I am trying to have alternating rows different colors in my jqxGrid. Altrows is not giving us the result we want.

    When using the cellsrenderer, it only shows the left and top margins as shown here: http://imgur.com/0k08rta

    When the margins are removed, there is no border highlight when the mouse hovers over the cell. Here is the code I’m using:

    var cellsrenderer = function (row, column, value, defaultHtml) {
        if (row % 2 == 0) {
            var element = $(defaultHtml);
            element.css({ 'background-color': '#669EDE', 'width': '100%', 'height': '100%', 'margin': '5px' });
            return element[0].outerHTML;
        }
        else {
            var element = $(defaultHtml);
            element.css({ 'background-color': 'white', 'width': '100%', 'height': '100%', 'margin': '5px'});
            return element[0].outerHTML;
        }
    
        return defaultHtml;
    }

    Also, I tried using the cellclass to do this, but I’m unable to get the row index:

    var cellclass = function (rowindex, columnfield, value) {
        if (rowindex %2 != 2) {
            return 'blue';
        }
        else return 'white';
    }

    Thanks!


    Dimitar
    Participant

    Hello msalvatore,

    Please try the following:

    var cellsrenderer = function (row, column, value, defaultHtml) {
        if (row % 2 == 0) {
            var element = $(defaultHtml);
            element.css({ 'background-color': '#669EDE', 'margin': '5px', 'padding-bottom': '0px' });
            return element[0].outerHTML;
        }
        else {
            var element = $(defaultHtml);
            element.css({ 'background-color': 'white', 'margin': '5px', 'padding-bottom': '0px' });
            return element[0].outerHTML;
        }
    
        return defaultHtml;
    }

    As for the cellclassname callback function, it correctly gets the row index. Please check out the demo Cells Styling.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    msalvatore
    Participant

    Thanks!

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

You must be logged in to reply to this topic.