loadRangesfromJSON (tabSheetDataResult, ranges)
tabSheetDataResult. JSON object that contains the data to be loaded.
ranges. Cell range where the data is to be loaded.
The loadRangesfromJSON method loads data to the table from a JSON object.
To execute the example the HTML page must contain the GridBox component named grid (see Example of Placing the GridBox Component).
Add a button in the BODY tag:
<button onclick="loadData()">Load Data</button>
Add a function to be executed on clicking the button:
function loadData() {
var testData = { ranges: { Part: { sheet: { TabSheetData: { Cells: { Cell: [{ L: 1, T: 1, CellData: { V: "test", FT: "test"}}]}}}}} };
grid.getControl().getModel().getDataSource().loadRangesfromJSON(testData, grid.getControl().getRange(1, 1, 1, 1))
};
Add a handler for the TabSheetDataSource.RangeLoaded event:
var tSource = grid.getControl().getModel().getDataSource()
tSource.RangeLoaded.add(function ()
{
console.log(tSource.isLoaded(), tSource.getSelection())
})
After executing the example clicking the button loads the text "test" to the A1 cell. The browser console outputs the value True: that is, the result of executing the TabSheetDataSource.isLoaded method, and an object with description of selected cell range: that is, a result of executing the TabSheetDataSource.getSelection method.
See also: