jQWidgets Forums

jQuery UI Widgets Forums Grid Maintain cell data formatting on rendering

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 11 months ago.

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

  • ohioguy67
    Member

    Sorry but I have yet another question. In my table, I have a date column where I specify a specific cellsformat attribute when I define the columns. I want to be able to have this column to sometimes be displayed in red. So I added a cellsrenderer attribute to the grid definition and it points to the following function (I replaced the greater than symbol with X and less than symbol with Y so the line displays here):

    var cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties) {
    if (some condition) {
    var string = ‘XdivY style=”color: #ff0000; text-align: ‘ + columnproperties.cellsalign + ‘;”Y’ + value + ‘X/divY’;
    return string;
    }
    };

    When my grid is displayed, the column is displayed in red correctly. However, the cell formatting is lost and the date is displayed in the default format. What do I have to do so the format is maintained?

    Thank you for your assistance.


    Peter Stoev
    Keymaster

    Hi,

    That is expected behavior, because the purpose of the “cellsrenderer” callback is to allow you to override the built-in cells rendering. If you want to change only colors, you may use the “cellclassname” callback instead – http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/gridcellclass.htm?web

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    ohioguy67
    Member

    Thank you! I didn’t see that property in the documentation but it’s exactly what I needed!


    Peter Stoev
    Keymaster

    Hi,

    The property is in the documentation and you can find it in the documentation about the Grid columns in the API as it is a column property.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.