createDataRows(parentElement, columns)
JavaScript API Reference/Ab.grid.ReportGrid object
createDataRows(parentElement, columns)
Creates the ReportGrid’s data row content. This function can be overridden and either handle all the row creation or call the existing implementation before modifying the content.
Parameters:
-
parentElement
(DOM reference): the DOM element to which the data rows are appended, typically the ReportGrid’stableBodyElement
-
columns
(array ofAb.grid.Column
objects): the column objects containing their id, display name and display type
Example:
Override the existing data row creation, calling the existing implementation and then modifying the content:
// save existing
implementation & use within overrriden
// grid.originalCreateDataRows
= grid.createDataRows;
grid.createDataRows
= function(parentElement, columns) {
grid.originalCreateDataRows(parentElement, columns);
// get data rows, iterate and modify
var dataRows =
YAHOO.util.Dom.getElementsByClassName('dataRow',
"tr", parentElement);
for (var i=0, row; row = dataRows[i]; i++) {
...
}
}