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
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).
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.
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/.