[]
        
(Showing Draft Content)

Edit Mode Always

You can set the cell to always be in edit mode when the user clicks on it. Normally the user types or double-clicks before the cell goes into edit mode.


Set the startEdit method in the EnterCell event to cause the cell to go into edit mode as soon as the user clicks on or uses tab or enter to move to the cell.


The following code sample puts the cell in edit mode when the user clicks on it.

window.onload = function()
{
   var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
   var activeSheet = spread.getActiveSheet();
   
   // Set to be always in input mode.
   spread.bind(GC.Spread.Sheets.Events.EnterCell, function (event, data)
   {
      var sheet = data.sheet;
      activeSheet.startEdit(false);
   });
}


If the selectAll parameter in the startEdit method is set to true, then it selects all the text when the text is changed during editing.


The following code sample selects the text when editing starts.

$(document).ready(function ()
{
   new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
   var sheet = spread.getActiveSheet();
   sheet.setValue(0, 0, "ABC", GC.Spread.Sheets.SheetArea.viewport);

   // Set it to be always in input mode.
   spread.bind(GC.Spread.Sheets.Events.EnterCell, function (event, data)
   {
      var activeSheet = data.sheet;
      activeSheet.startEdit(true);
   });
});