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

Spreadsheet Destroy Not Working

3 Answers 208 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 18 Jan 2017, 09:46 AM

I have a spreadsheet widget, which is created on page load. I have a button, which populates the data using the transport layer. Every time the button is pressed I need to destroy the spreadsheet and then recreate it. I am doing the following: (our page uses angularjs in case that relevant)

if (spreadSheet != null) {
$("#seasonalitySpreadsheet").data("kendoSpreadsheet").destroy();
}

// recreate spreadsheet here.

However - the first spreadsheet is not being removed from the DOM.

Am I missing something?

Thanks

Marc

3 Answers, 1 is accepted

Sort by
0
Christy
Top achievements
Rank 1
answered on 19 Jan 2017, 07:20 PM

I am doing something similar with angular and used the following code:

// In view, k-scope-field = "spreadsheet"
var spreadsheet = $scope.spreadsheet;
var sheet = spreadsheet.activeSheet();
sheet.range(kendo.spreadsheet.SHEETREF).clear();

It works pretty well unless the user is in mid-edit when they decide to close that spreadsheet.

HTH

0
Accepted
Stefan
Telerik team
answered on 20 Jan 2017, 07:52 AM
Hello Marc,

Depending on the desired result, after the widget is destroyed the DOM element have to be removed manually.

Please check the article in our documentation:

http://docs.telerik.com/kendo-ui/intro/widget-basics/destroy

Also, check the Dojo demonstrating this:

http://dojo.telerik.com/eFASU

I hope this will help to achieve the desired result

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 20 Jan 2017, 08:00 AM

Hi Stefan,

Sorry my mistake! I did read the documentation but I must have missed the bit that mentioned, the HTML which is removed is content outside the widget, and not the widget itself!

Thanks again,

Marc

Tags
Spreadsheet
Asked by
Marc
Top achievements
Rank 1
Answers by
Christy
Top achievements
Rank 1
Stefan
Telerik team
Marc
Top achievements
Rank 1
Share this question
or