We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How refresh or add DataSource in loadComplete?

Thread ID:

Created:

Updated:

Platform:

Replies:

128098 Jan 2,2017 08:29 AM Jan 4,2017 01:15 AM JavaScript 3
loading
Tags: ejSpreadSheet
Oscar Montesinos
Asked On January 2, 2017 08:29 AM

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

Silambarasan I [Syncfusion]
Replied On January 3, 2017 06:12 AM

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 


Oscar Montesinos
Replied On January 3, 2017 06:30 AM

Hello, thanks a lot, it works fine

Silambarasan I [Syncfusion]
Replied On January 4, 2017 01:15 AM

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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;