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

How to reload data into spreadsheet?

4 Answers 691 Views
Spreadsheet
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

4 Answers, 1 is accepted

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

Hello Philip,

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
Philip
Top achievements
Rank 1
Veteran
Iron
answered on 24 Sep 2020, 05:36 PM

Thank you for the explanation and sample code Neli.

For the Kendo Spreadsheet, is it possible to show the loading dialog popup while the data is being loaded? I see that the Kendo Grid has this feature built-in but I am not sure if the Spreadsheet has this as well.

0
Neli
Telerik team
answered on 28 Sep 2020, 09:36 AM

Hi Philip,

In order to achieve the desired appearance, you could try to use the new Kendo Loader. Here is a modified Dojo example where the Loader is displayed until the data in the Spreadsheet is populated.  

Another possibility is to use the kendo progress() method.

Let me know in case you have any other questions on the matter.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Philip
Top achievements
Rank 1
Veteran
Iron
answered on 29 Sep 2020, 11:35 PM
Thank you so much for your replies on this Neli, it has resolved my questions.
Tags
Spreadsheet
Asked by
Philip
Top achievements
Rank 1
Veteran
Iron
Answers by
Neli
Telerik team
Philip
Top achievements
Rank 1
Veteran
Iron
Share this question
or