How refresh or add DataSource in loadComplete?
Hello, I have a ejSpreedSheet and I open it perfectly, but I need change or add one dataSource to Sheet number 1, I released this code:
.ejSpreadsheet({
allowInsert: true,
exportSettings:
{
allowExporting: true,
excelUrl: eg3Config.Url + "api/JSXLExport/ExportToExcel",
csvUrl: eg3Config.Url + "api/JSXLExport/ExportToCsv",
pdfUrl: eg3Config.Url + "api/JSXLExport/ExportToPdf"
},
allowImport: true,
importSettings: {
importMapper: eg3Config.Url + "api/JSXLExport/Import?file="+newfile,
importUrl: "http://prueba"
},
loadComplete: function (args) {
var xlObj = $("#container").data("ejSpreadsheet");
xlObj.clearRangeData("A7:P15","" , null, true);
var sheet=xlObj.getSheet(1);
sheet.dataSource=e.result;
sheet.startCell="A4";
sheet.showHeader=false;
xlObj.refreshContent(1);
}
});
but refreshContent don't refresh data in sheet.
best regards
Oscar Montesinos
SIGN IN To post a reply.
3 Replies
SI
Silambarasan I
Syncfusion Team
January 3, 2017 11:12 AM UTC
Hi Oscar,
Thank you for using Syncfusion products.
We have checked your reported query and we would like to let you know that using ‘updateRange()’ client-side method allows to update the range of cells with specified rangeSetting in Spreadsheet. So, we suggest you to use ‘updateRange()’ to achieve your requirement “To change or add dataSource to Sheet 1”. Please refer the below modified code example.
|
var dataSource = [
//...
];
$("#Spreadsheet").ejSpreadsheet({
//...
loadComplete: function (args) {
//var xlObj = $("#container").data("ejSpreadsheet");
var xlObj = this, settings;
xlObj.clearRangeData("A7:P15", "", null, true);
settings = { dataSource: dataSource, showHeader: false, startCell: "A4" };
// To update range of cells with the specified settings
xlObj.updateRange(1, settings); // 1 => Sheet Index
}
});
|
For your convenience, we have prepared a sample to demonstrate this and the same can be downloaded from the following location,
Regards,
Silambarasan I
OM
Oscar Montesinos
January 3, 2017 11:30 AM UTC
Hello, thanks a lot, it works fine
SI
Silambarasan I
Syncfusion Team
January 4, 2017 06:15 AM UTC
Hi Oscar,
Thanks for your update.
We are happy to hear that your requirement has been achieved. Kindly get back to us if you need further assistance. We will be happy to help you out.
Regards,
Silambarasan I
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
OM Oscar Montesinos
- Jan 2, 2017 01:29 PM UTC
- Jan 4, 2017 06:15 AM UTC