I load 100 record in spread sheet now I update data source
and add 50 records with following query
$("#Spreadsheet").ejSpreadsheet("getDataSettings", 1)[0].dataSource.push(jData);
$("#Spreadsheet").ejSpreadsheet("refreshSpreadsheet");
Data source update but 150 records not show on spread sheet.
Method Second:
var xlObj = $("#Spreadsheet").data("ejSpreadsheet");
var settings = [{ dataSource: response, showHeader: false, startCell: "A101" }]; //(Add 50 record after 100 record)
xlObj.updateRange(1, settings);
$("#Spreadsheet").ejSpreadsheet("refreshSpreadsheet");
but they show garbage value.
Please suggest proper format for update data source and show in sync fusion grid.
Thanks
var dataSource = [ //.. ]; $("#Spreadsheet").ejSpreadsheet({ loadComplete: function (args) { var xlObj = this, settings; settings = { dataSource: dataSource, showHeader: false, startCell: "A1" }; // To update range of cells with the specified settings xlObj.updateRange(1, settings); // 1 => Sheet Index } }); |
<div id="Spreadsheet"></div> <script type="text/javascript"> var intervalId, response = [], newDataSource = []; //Datasource for inital binding for (var i = 1; i <= 100; i++) response.push({ ProductID: "Item" + i, ProductName: "PName" + i, ... UnitsInStock: (10 * i) }); //Datasource for updating range after 10 seconds for (var i = 101; i <= 150; i++) newDataSource.push({ ProductID: "Item" + i, ProductName: "PName" + i, ... UnitsInStock: (10 * i) }); $(function () { $("#Spreadsheet").ejSpreadsheet({ sheets: [{ rangeSettings: [{ dataSource: response, startCell: "A1", showHeader: true }], }], /*response contain 100 records*/ //... }); intervalId = setInterval(updateNewRecords, 10000); }); updateNewRecords = function () { var xlObj = $("#Spreadsheet").data("ejSpreadsheet"); settings = { dataSource: newDataSource, showHeader: false, startCell: "A102" }; // To update range of cells with the specified settings xlObj.updateRange(1, settings); // 1 => Sheet Index xlObj.refreshSpreadsheet(); //Clear the interval timer clearInterval(intervalId); } </script> |