jQuery UI Widgets Forums Getting Started Cellrenderer Method is getting called for all rows everytime

This topic contains 3 replies, has 2 voices, and was last updated by  admin 6 months, 2 weeks ago.

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

  • Manu Vashishtha
    Participant

    Hello

    I have 3000 rows in my jqxgrid. and I am using CellsRenderer method for styling of cells and rows.
    I want to update the single row styles in my grid when client scans a document. but when CellsRenderer method is getting called ,it everytime updates
    all the rows and cells styles. It is time consuming to update the complete grid’s styles again and again and also
    the problem is I Only have single row’s styles so, the prev styles get removed.
    I want the previously set styles to retain when I update the new values.
    Basically, I want CellsRenderer method to update cells of a particular row.
    I don’t want to update style of all rows. Only single row styles.

    Is there any solution for it.
    This is my Code:–

    function CellsRenderer(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
    for (var i = 0; i < _gridStyles.length; i++) {
    if (_gridStyles[i].Row == row + 1 && _gridStyles[i].Col == columnfield) {
    var _foreColor = _gridStyles[i].ForeColor;
    var _backColor = _gridStyles[i].BackColor;
    var _style = _gridStyles[i];
    var _fontItalic = “”;
    var _fontBold = “”;
    if (_style.FontItalic == true) {
    _fontItalic = “italic”;
    }
    if (_style.FontBold == true) {
    _fontBold = “bold”;
    }

    return ‘<span style=”font-family:’ + _style.FontName + ‘;float: ‘ + columnproperties.cellsalign + ‘;font-weight:’ + _fontBold + ‘;font-size:’ + _style.FontSize + ‘;font-style:’ + _fontItalic + ‘;margin: 4px; float: ‘ + columnproperties.cellsalign + ‘; color: ‘ + _foreColor.Name + ‘;”>’ + value + ‘</span>’;
    }
    }
    }

    Thanks & Regards
    Manu Vashishtha


    admin
    Keymaster

    Hi Manu Vashishtha,

    cellsrenderer is called for all cells in the rows which are in the view(visible area). It is not called for all rows.
    If you just want to update CSS styles, it is better to use cellclassname instead and provide a custom CSS class string for your cells.

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/


    Manu Vashishtha
    Participant

    But, this is not the solution. I have single row styles or class name. Can’t refresh my grid every time.
    There must be an option for updating single row styles, without refreshing the grid.


    admin
    Keymaster

    Hi Manu,

    Please, refer to https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/columncellstyle.htm?light in order to learn how to apply styling to cells.

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

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

You must be logged in to reply to this topic.