- Home
- Forum
- JavaScript - EJ 2
- Set colCount and rowCount after Spreadsheet has been created
Set colCount and rowCount after Spreadsheet has been created
I believe that you can specify the number of rows and column when you create a spreadsheet control, but can you alter the number of of rows/columns AFTER the spreadsheet is created and rendered?
I do not want any rows or column visible beyond the "used range". For example, I want to display a 8 row by 8 column spreadsheet, without the user being able to navigate outside of that range. Then, I may want to programmatically increase or decrease the rol/col count (e.g. expand to 10 x 10).
Can you please show me the proper javascript to create a 8x8 blank spreadsheet and the code to change the col/row count afterwards?
//Initialize Spreadsheet component.var spreadsheet = new ej.spreadsheet.Spreadsheet({
height: 800, sheets: [{ name: "MySheet", rowCount: 10, //doesn't work now, it worked earlier, I thought colCount: 10 }]//Render initialized Spreadsheet component.spreadsheet.appendTo('#spreadsheet');JS2 - Javascript - 19.2.0.44
I think that I have found the solution:
scrollSettings : { isFinite: true},Placing this in the constructor seems to make everything work as expected.
|
var spreadsheet = new ej.spreadsheet.Spreadsheet({
sheets: [
{
name: 'MySheet',
rowCount: 8,
colCount: 8 }
],
scrollSettings: { isFinite: true }
});
//Render initialized Spreadsheet component
spreadsheet.appendTo('#spreadsheet');
button = new ej.buttons.Button({});
button.appendTo('#btn');
button.element.onclick = function() {
spreadsheet.sheets[0].colCount = 10;
spreadsheet.sheets[0].rowCount = 10; }; |
Please find the sample link below,
Janakiraman S.
- 2 Replies
- 2 Participants
-
JO John
- Jul 3, 2021 09:36 PM UTC
- Jul 6, 2021 03:11 AM UTC