This is a migrated thread and some comments may be shown as answers.

How to reload data into spreadsheet?

2 Answers 91 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Veteran
Iron
Philip asked on 22 Sep 2020, 05:22 PM
Please see this sample code I have, I am trying to reload data from a remote server into the spreadsheet with every click of the button.

The issue is after clicking the search button a second  time to fetch new data, the spreadsheet is appended with a new one.

What is the proper way to reload data into the spreadsheet?

Link to sample code
https://dojo.telerik.com/ewigOKam

2 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 24 Sep 2020, 03:05 PM

Hi Philip,

I have just replied in the other thread on the same topic. For convenience, I will paste my reply here below as well. I would recommend keeping the conversation in a single thread. 

 

The observed issue is caused by the fact, that when the "Search" button is clicked, another Spreadsheet will be initialized. 

To avoid this you could perform an additional check if the widget has been initialized. This way you could initialize it only if it is needed. Then you could load the dataSource as per the requirements. 

       var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
        
        if(!spreadsheet){
        	 $("#spreadsheet").kendoSpreadsheet();
          	spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
        }         
        
        var sheet = spreadsheet.activeSheet();
        sheet.setDataSource(dataSource);

 Here is the modified Dojo example.

I hope, that the above helps you. In case you have any other questions, please do not hesitate to contact us.

 

Regards,
Neli
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Pistle
Top achievements
Rank 1
Veteran
answered on 05 Oct 2020, 12:06 PM

Refresh an external data connection-
Update only the selected data Press ALT+F5, or on the Data tab, in the Queries & Connections group, click the arrow under Refresh All, and then click Refresh.
Update all data in the workbook Press CTRL+ALT+F5, or on the Data tab, in the Queries & Connections group, click Refresh All.

I hope this will be helpful.

Best Regards

Tags
General Discussions
Asked by
Philip
Top achievements
Rank 1
Veteran
Iron
Answers by
Neli
Telerik team
Pistle
Top achievements
Rank 1
Veteran
Share this question
or