jQuery UI Widgets › Forums › Getting Started › Cellrenderer Method is getting called for all rows everytime
Tagged: datagrid, jqxgrid styling
This topic contains 3 replies, has 2 voices, and was last updated by admin 3 years, 8 months ago.
-
Author
-
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 VashishthaHi 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 StoevjQWidgets Team
https://www.jqwidgets.com/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.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 StoevjQWidgets Team
https://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.