Spreadsheet Destroy Not Working

4 posts, 1 answers
  1. Marc
    Marc avatar
    156 posts
    Member since:
    Sep 2016

    Posted 18 Jan Link to this post

    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

  2. Christy
    Christy avatar
    48 posts
    Member since:
    May 2016

    Posted 19 Jan in reply to Marc Link to this post

    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

  3. Answer
    Stefan
    Admin
    Stefan avatar
    907 posts

    Posted 20 Jan Link to this post

    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.
  4. Marc
    Marc avatar
    156 posts
    Member since:
    Sep 2016

    Posted 20 Jan in reply to Stefan Link to this post

    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

Back to Top