SET ACTIVE CELL

IS there a way from javascript to set active cell.  For instance set cursor or focus to E3 cell in spreadsheet.


1 Reply

SP Sangeetha Priya Murugan Syncfusion Team September 13, 2023 02:33 PM UTC

Hi Stephen,


Your requirement can be achieved in our spreadsheet by using the selectRange method. If you need to set the active cell at initial load, you can use the selectRange method in the created event.


Or else, if you need to set an active cell after importing Excel into the spreadsheet, you can use this method in the openComplete event.


Code Block:


created: (): void => {

    // Applies cell and number formatting to specified range of the active sheet

    spreadsheet.cellFormat(

      { fontWeight: 'bold', textAlign: 'center', verticalAlign: 'middle' },

      'A1:F1'

    );

    spreadsheet.numberFormat('$#,##0.00', 'F2:F31');

    // To select the particular cell at initial loading.

    spreadsheet.selectRange('E3');

  },

  openComplete: (): void => {

    // To select the particular cell after importing the excel file into the spreadsheet.

    spreadsheet.selectRange('D3');

  },

 


Sample Link: https://stackblitz.com/edit/it8dyc?file=index.ts


API Link: https://helpej2.syncfusion.com/documentation/api/spreadsheet/#selectrange


Documentation Link: https://ej2.syncfusion.com/documentation/spreadsheet/selection


Please check the above links and get back to us, if you need any further assistance on this.


Loader.
Up arrow icon