Remove All Data from sheet

20 posts, 1 answers
  1. Marc
    Marc avatar
    171 posts
    Member since:
    Sep 2016

    Posted 12 Jan 2017 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
    1266 posts

    Posted 13 Jan 2017 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
    171 posts
    Member since:
    Sep 2016

    Posted 13 Jan 2017 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
    171 posts
    Member since:
    Sep 2016

    Posted 16 Jan 2017 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
    171 posts
    Member since:
    Sep 2016

    Posted 16 Jan 2017 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
    1266 posts

    Posted 16 Jan 2017 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.
  7. Johnson
    Johnson avatar
    14 posts
    Member since:
    Jun 2011

    Posted 07 Feb 2018 in reply to Dimiter Topalov Link to this post

    Hi Dimiter,

    How to clear the applied "Filter" condition for the entire spreadsheet....

    Best Regards...

  8. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1201 posts

    Posted 08 Feb 2018 Link to this post

    Hi Johnson,

    To clear the applied filter condition for the entire Spreadsheet Sheet, you will first need to get reference to the range, that represents the entire Sheet:
    var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
    var sheet = spreadsheet.activeSheet();
    var rowsCount = sheet._rows._count;
    var columnsCount = sheet._columns._count;
    var sheetRange= sheet.range(0, 0, rowsCount, columnsCount);

    Then you could reset the filter condition:
    sheetRange.filter(false);
    sheetRange.filter(true);

    Regards,
    Veselin Tsvetanov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  9. Johnson
    Johnson avatar
    14 posts
    Member since:
    Jun 2011

    Posted 12 Feb 2018 in reply to Veselin Tsvetanov Link to this post

    Hi Veselin,

    thank you very much ..its working perfectly ..

    Best Regards...

     

     

  10. Johnson
    Johnson avatar
    14 posts
    Member since:
    Jun 2011

    Posted 12 Feb 2018 in reply to Veselin Tsvetanov Link to this post

    Hi Veselin,

    How tp get the total rows count after "filter" is applied, is there Jquery event while filtering ..

    Best Regards,

  11. Johnson
    Johnson avatar
    14 posts
    Member since:
    Jun 2011

    Posted 12 Feb 2018 in reply to Veselin Tsvetanov Link to this post

    Hi Veselin,

    How to add ActionLink to the spreadsheet row-column.. please advice ...

    Best Regards,

  12. Neli
    Admin
    Neli avatar
    289 posts

    Posted 13 Feb 2018 Link to this post

    Hi Johnson,

    I am afraid that 'filtering' event in Kendo UI Spreadsheet is not supported. Also there is no built in functionality for adding ActionLink to row or column. 

    I would suggest you to log your ideas in our Feedback Portal. This way the other users can vote for the ideas. The issues which gain more popularity will be considered for future implementation. 

    Regards,
    Neli
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  13. Johnson
    Johnson avatar
    14 posts
    Member since:
    Jun 2011

    Posted 13 Feb 2018 in reply to Neli Link to this post

    Hi Neli,

    Thank you very much for your details.. very disappointing ..could you please advice me to get the spread sheet selected row column value  in Jquery .. 

    Best Regards..

  14. Johnson
    Johnson avatar
    14 posts
    Member since:
    Jun 2011

    Posted 14 Feb 2018 in reply to Johnson Link to this post

    Hi Neli,

    I managed to get the selected value..thank you..  

    Best Regards,

  15. Neli
    Admin
    Neli avatar
    289 posts

    Posted 15 Feb 2018 Link to this post

    Hello Johnson,

    After a discussion with our developers I can suggest you a custom solution in order to find the total rows in the Spreadsheet after filtering.
    You can check the total rows count in the Spreadsheet by using the following
    var totalCount = this.view._sheet.toJSON().rows.length;

    Then, for every row you can check if it is hidden or not and increase/decrease respective counters:
    for (var i = 0; i < this.view._sheet.toJSON().rows.length; i++) {
    if (this.view._sheet.isHiddenRow(i)) {
       totalCount--;
        hiddenRows++
    }
    }

    I hope you will find the linked Dojo example helpful

    Regards,
    Neli
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  16. Johnson
    Johnson avatar
    14 posts
    Member since:
    Jun 2011

    Posted 15 Feb 2018 in reply to Neli Link to this post

    Hi Neli,

    Could you please give me the sample in Razor syntax ...

    Best Regards..

  17. Neli
    Admin
    Neli avatar
    289 posts

    Posted 19 Feb 2018 Link to this post

    Hello Johnson,

    There will not be huge difference if you use Kendo UI for jQuery widgets or the ASP.NET MVC wrappers. You will declare the Spreadsheet widget in a different way. You can take a look of the Spreadsheet Demos for MVC on the following link. 

    In both cases you will need to include the following script: 
    <script>
        kendo.spreadsheet.Controller.fn.onCommandRequest = function (e) {
            if (e.command) {
            this._execute(e);
          } else {
            this._workbook.undoRedoStack[e.action]();
          }
          if (e.command === "ApplyFilterCommand") {
            var totalCount = this.view._sheet.toJSON().rows.length;
            var hiddenRows = 0
            alert(totalCount-1);
            for (var i = 0; i < this.view._sheet.toJSON().rows.length; i++) {
                if (this.view._sheet.isHiddenRow(i)) {
                totalCount--;
                hiddenRows++
              }
            }
                    
            alert('hidden: ' + hiddenRows);
          }
        }   
    </script>


    Regards,
    Neli
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  18. samk
    samk avatar
    5 posts
    Member since:
    May 2018

    Posted 23 Jul 2018 in reply to Dimiter Topalov Link to this post

    This will clear everything from the spreadsheet including the backgrounds. Is there a way to clear just the cell values?
  19. Neli
    Admin
    Neli avatar
    289 posts

    Posted 25 Jul 2018 Link to this post

    Hello,

    Could you please describe the issue in more details? The sample provided previously is used to show the total count of hidden rows when the data in the Spreadsheet is filtered. The provided script does not affect the styles of the widget so no background is cleared. Here is a screencast. Please let me know if I am missing something.


    Regards,
    Neli
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  20. samk
    samk avatar
    5 posts
    Member since:
    May 2018

    Posted 25 Jul 2018 Link to this post

    Please discard my comment. I found a way to clear the data. Thanks!
Back to Top