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

Kendo Spreadsheet adding data second sheet

5 Answers 539 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 17 Aug 2016, 08:29 PM

Right now I have and Active Sheet and inactive sheet. Onclick I load data for the the Active sheet.  I understand how to create another sheet tab name. Is there any documentation on  Loading data to the second sheet or syntax.

Active Sheet >>>>  var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
        var sheet = spreadsheet.activeSheet();

sheet.range("D6:I6").values(column);

InActive Sheet >>>>  var spreadsheet 2= $("#spreadsheet").data("kendoSpreadsheet");
        var sheet2 = spreadsheet.InactiveSheet();
sheet2.range("D6:I6").values(newcolumn);

5 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 19 Aug 2016, 10:35 AM

Hello Frank,

The sheets method returns a list of all sheets. The inactive ones are the ones that are different than the active sheet.

Regards,
Alex Gyoshev
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Frank
Top achievements
Rank 1
answered on 19 Aug 2016, 12:38 PM
I do not think you understand what I am trying to do. The inactive sheet I need to bind to also.
0
Alex Gyoshev
Telerik team
answered on 22 Aug 2016, 07:29 AM

Hello Frank,

You can loop through the sheets and call the setDataSource method to bind them to a data source. There is no inactiveSheet method, because there may be more than one inactive sheets.

Regards,
Alex Gyoshev
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Ajinkya
Top achievements
Rank 1
answered on 01 Feb 2021, 10:43 AM

How to add column name from the current data source into newly inserted sheet. tried with insertSheet and setDataSource method but it creates extra one more sheet. . also 

 

            var spreadsheet = $("#spreadsheet");
            var sheets = $("#spreadsheet").data("kendoSpreadsheet").sheets()
            lengthsheets=sheets.length
           var temp=     $("#spreadsheet").data("kendoSpreadsheet").activeSheet(sheets[sheets.length-1]);
temp.setDataSource([], [ "ProductName", "UnitPrice" ]);

 

gives errror as undefined  setDataSource. Please help

0
Martin
Telerik team
answered on 03 Feb 2021, 09:18 AM

Hello, Ajinkya,

I am not sure I completely understand the question. Could you please provide some additional information so that I can better understand the requirement? 

As for the error, after setting the active sheet, you need to use the activeSheet method again to get the active sheet:

$("#spreadsheet").kendoSpreadsheet();
        var spreadsheet = $("#spreadsheet");
        var sheets = $("#spreadsheet").data("kendoSpreadsheet").sheets()
        var lengthsheets=sheets.length;
        $("#spreadsheet").data("kendoSpreadsheet").activeSheet(sheets[sheets.length-1]);
        var temp= $("#spreadsheet").data("kendoSpreadsheet").activeSheet()
        temp.setDataSource(dataSource, [ "ProductName", "UnitPrice" ]);
  

Here is a small example for reference.

Regards,
Martin
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/.

Tags
Spreadsheet
Asked by
Frank
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Frank
Top achievements
Rank 1
Ajinkya
Top achievements
Rank 1
Martin
Telerik team
Share this question
or