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

Setting row count after set up

3 Answers 609 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 24 Dec 2015, 04:28 PM

I am trying to set the max row count after I retrieved the data from AJAX call. The default option for the number of rows is 200. I am needing to be able to change this number based on the number of rows returned from AJAX call. I want the page to have to have the default of 200 when the page loads.

The user then chooses from a dropdown on the page to query the backend for data which will have a different number of rows each time. I was hoping to be able to just set the rows property on the sheet.options object, but it does not look like these values are re-read after initialization.

How should I do this? Especially if I am going to have multiple tabs of data with different number of rows.

Thanks.

3 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 24 Dec 2015, 04:38 PM

Another reason for this question is it just suggested to set this value to really large number if I have multiple tabs?

For Example:

Tab 1: 20 rows
Tab 2: 100 rows
Tab 3: 2000 rows
Tab 4: 500 rows

If the max count defaults to 200, the tabs with more 200 rows will fail. If I just set the max row count to 2000 rows, all of tabs will display, but now the tabs with only a few rows like Tab 1 will have over 1,000 blank rows.

 

0
Dimiter Madjarov
Telerik team
answered on 25 Dec 2015, 10:17 AM

Hello John,

You could use the insertSheet method to add new sheets with specific options to the Spreadsheet. The object which is passed as a parameter to the method should have an options.rows configuration which specifies the number of rows in the new sheet.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Tim
Top achievements
Rank 1
answered on 08 Feb 2018, 11:00 PM

I just ran into this issue of wanting to expand the # of rows by one from a fixed row length sheet. Here is a direct and fast way to add a row in just a few lines of code that handles the copy data/reset sheet and everything in a simple call and also preserves hidden column attributes:

            var workbook = yourKendoWorkSheet.toJSON();
            workbook.rows = workbook.sheets[0].rows.push({}); // push x empty rows if you'd like, the {} can also be a full row option set
            yourKendoWorkSheet.fromJSON(workbook);

Hope this helps someone

Tags
Spreadsheet
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Tim
Top achievements
Rank 1
Share this question
or