RealToGlobalIndexes: Object;
The RealToGlobalIndexes property compares real and global indexes of table data series.
Use JSON or the setRealToGlobalIndexes method to set the property value and the getRealToGlobalIndexes method to get the property value.
The property contains a JSON object, which fields contain real table data index, and values contain global index.
The property is read-only.
To execute the example, the HTML page must contain the DataGrid component named grid (see Example of Creating an Asynchronous Data Table). Get asynchronous table data as a string:
var values = [];
// Transforms tale series data into a text string
var rowToPlainText = function(sender, args) {
var index = sender.RowIndex;
var jsonCells = [];
// Get all table rows
var rows = grid.getData().Rows.Row;
// Get the first index of loaded data series
var startGlobalRowIndex = grid.getStartRowIndex();
// Returns row template
var template = grid.getMeasures().getRowTemplate();
// Get settings of mapping of real and global data indexes
var realToGlobalIndexes = grid.getRealToGlobalIndexes();
// Get mapping of real indexes to additional data series
var realAdditionalRows = grid.getRealAdditionalRows();
var row = rows[index];
if (typeof realToGlobalIndexes[index] !== "undefined") {
// Calculate data series index
index = realToGlobalIndexes[index] - startGlobalRowIndex;
// Get object with data for the series with the specified index
jsonCells = rows[index].Cells;
}
else if (typeof realAdditionalRows[index] !== "undefined") {
jsonCells = realAdditionalRows[index].Cells;
}
// Process all cells of each row
for (var colIndex in template) {
if (template.hasOwnProperty(colIndex)) {
values.push(jsonCells[colIndex].CellData['@FT']);
values.push('\t');
}
}
// Move string
values.pop();
values.push('\n');
}
// Get table data as a string
grid.eachRowInSource(rowToPlainText, this);
console.log("Table data:\n %s", values.toString());
After executing this example the browser console displays table data as a string:
Table data:
0, ,Russia, ,143, ,ru,
,1, ,France, ,65, ,fr
See also: