Celltype when cell clicked

Posted by: baloghbencefacebook on 4 November 2021, 9:55 am EST

    • Post Options:
    • Link

    Posted 4 November 2021, 9:55 am EST

    I tried to modify a cell’s type when I click it. This is the code I used:

    workbook.bind(GCSheets.Events.CellClick, (e: EventParam, info: any) => {

    let cellType = new GCSheets.CellTypes.ComboBox();

    cellType.items([“a”, “b”]);

    this.getWorkbook().getActiveSheet().getCell(info.row, info.col).cellType(cellType);
    

    });

    The ▼ icon appears, but when I click it, the dropdown does not appear and the editor functions like a textbox.

  • Posted 5 November 2021, 5:19 am EST

    Im using the react version of 14.2.2

  • Posted 8 November 2021, 5:21 am EST

    Hi,

    For this, you need to use startEdit method. Please refer to the following code snippet and let me know if you face any issues.

    
    var GCSheets = GC.Spread.Sheets;
            spread.bind(GCSheets.Events.CellClick, (e, info) => {
                let cellType = new GCSheets.CellTypes.ComboBox();
                cellType.items(["a", "b"]);
    
                info.sheet.getCell(info.row, info.col).cellType(cellType);
                info.sheet.startEdit()
            });
        }
    
    

    sample: https://jscodemine.grapecity.com/share/mVhB3FkPmEOXn9DuoMfXHw/?isEmbed=true&isExplorerShow=false

    API References:

    startEdit: https://www.grapecity.com/spreadjs/docs/v14/online/SpreadJS~GC.Spread.Sheets.Worksheet~startEdit.html

    regards

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels