Non-Editable Columns

Posted by: srinivasan.lakshmanan on 5 July 2018, 6:50 pm EST

    • Post Options:
    • Link

    Posted 5 July 2018, 6:50 pm EST

    Hi,

    We have a requirement that we should restrict edit option for some columns in spreadsheet. we have done it using the protection option but we also need the hide option so is there any other alternate way to make a column readonly.

    Thanks in Advance

  • Posted 5 July 2018, 9:26 pm EST

    Hello,

    You can cancel the EditStarting event for the columns which you want non editable. For example:

    
    var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
    var activeSheet = spread.getActiveSheet();
    
    activeSheet.bind(GC.Spread.Sheets.Events.EditStarting, function (sender, args) {  
      if(args.col=2)
    {
    e.preventDefault();
    }
    });
    
    
    

    Thanks,

    Deepak Sharma

  • Posted 8 July 2018, 6:11 pm EST

    Hi deepak,

    When i use this above code i am getting the error stating that

    Uncaught ReferenceError: e is not defined

    please help me to figure it out

  • Posted 8 July 2018, 6:11 pm EST - Updated 3 October 2022, 2:13 am EST

  • Posted 9 July 2018, 8:42 pm EST

    Hello,

    Please modify the code as follows:

            var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
            var sheet = spread.getActiveSheet();
            sheet.bind(GC.Spread.Sheets.Events.EditStarting, function (sender, args, e) {
                if (args.col == 2)
                    {
                e.preventDefault();
                }
                });
    

    Thanks,

    Deepak Sharma

Need extra support?

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

Learn More

Forum Channels