Remove All Data from sheet

6 posts, 1 answers
  1. Marc
    Marc avatar
    133 posts
    Member since:
    Sep 2016

    Posted 12 Jan Link to this post

    Hi,

    Is there a method to clear all data from a specified sheet?

    Thanks!

  2. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    524 posts

    Posted 13 Jan Link to this post

    Hi Marc,

    You can use the following approach that is not part of the documented public API:

    http://dojo.telerik.com/UtajU

    ... or this one that uses documented methods and options only:

    http://dojo.telerik.com/IHURo

    Alternatively, you can remove a given sheet via the removeSheet() method, and insert an empty one (or a sheet with the desired options) via the insertSheet() method:

    http://dojo.telerik.com/UtajU/2

    I hope this helps.

    Regards,
    Dimiter Topalov
    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.
  3. Marc
    Marc avatar
    133 posts
    Member since:
    Sep 2016

    Posted 13 Jan in reply to Dimiter Topalov Link to this post

    Hey Dimiter!

    In the undocumented example, what does kendo.spreadsheet.SHEETREF represent? Can I use spreadSheet.options.sheets[0]?

    Thanks!

    Marc

  4. Marc
    Marc avatar
    133 posts
    Member since:
    Sep 2016

    Posted 16 Jan in reply to Marc Link to this post

    Also when using SHEETREF, I get the following:

     

    angular.js:21778 RangeError: Invalid array length
        at init.values (kendo.all.js:106562)
        at init._sheetChange (kendo.all.js:127561)
        at init.trigger (kendo.all.js:137)
        at init.triggerChange (kendo.all.js:108951)
        at init.batch (kendo.all.js:109812)
        at init.clear (kendo.all.js:106638)
        at Object.fn (current-stage-sku-line-results.js:110)
        at k.$digest (angular.js:21778)
        at k.$apply (angular.js:21778)
        at h (angular.js:21778)

    My statement is this: spreadSheet.activeSheet().range(kendo.spreadsheet.SHEETREF).clear();

    Thanks!

  5. Marc
    Marc avatar
    133 posts
    Member since:
    Sep 2016

    Posted 16 Jan in reply to Marc Link to this post

    Sorry I forgot to mention before - I am using the spreadsheet with a remote datasource, so I think what I'm really looking for is a way to clear all the data from the dataSource.

    Thanks!

  6. Answer
    Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    524 posts

    Posted 16 Jan Link to this post

    Hi Marc,

    Thank you for clearing up the desired functionality. To "clear" all the data from the dataSource, call the dataSource.data() method, passing it an empty array:

    http://dojo.telerik.com/aQORa

    As for the kendo.spreadsheet.SHEETREF - it is used internally, and basically creates a range, representing the whole sheet. You can find the specific implementation in our source code (kendo.spreadsheet.js file), if you are interested.

    Regards,
    Dimiter Topalov
    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.
Back to Top