How to enable 'hard edit' mode?

How to enable 'hard edit' mode?

InfentInfent Posts: 5Questions: 2Answers: 0
edited September 2019 in Free community support

How can I enable the 'hard edit' modus (orange ring) instead of the 'soft edit' modus (blue ring)?

I want keyCode 113 (F2) to enable the hard edit modus (just like Excel).
But when i use edit(), it enables the soft edit modus.

How can I get access to the hard edit modus?

Edit: I'm using keyTable with Editor, like this example

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Double click on the cell. Or click to focus and then press return.

    Allan

  • InfentInfent Posts: 5Questions: 2Answers: 0

    I understand, but that's not what I want.

    I want to edit the cell by pressing F2 (keyCode 113) to enable the hard edit modus.

    Is there an function to achieve that? Something like

    if(keyCode === 113) { table.cell(this).edit('hardEdit') }

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Currently no - there is no API for that. It would require a modification to the KeyTable library here. This is how it triggers a hard edit internally if you want to implement that.

    Its a good idea - thank you for it, and I'll look into it for the next release.

    Allan

  • InfentInfent Posts: 5Questions: 2Answers: 0

    So for anyone else who wants Excel like navigation/edit:

    • Enter/Return for column/cell down
    • F2 for (hard)edit mode

    Note: This disabled Enter/Return for (hard)edit a cell

    case 13:
    case 40: // down arrow
      if (navEnable) {
       this._shift(e, 'down');
      }
      break;
    
    case 113:
      this._editor(null, e, true);
      break;
    

    Could be improved, but this works for me

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Committed in here. Thanks :).

    Allan

  • InfentInfent Posts: 5Questions: 2Answers: 0

    @allan , I'm not sure but I think the break; needs to be after the if(){} statement.

    case 113: // F2 - Excel like hard edit
      if ( this.c.editor ) {
        this._editor(null, e, true);
        break;
      }
    

    But like this:

    case 113: // F2 - Excel like hard edit
      if ( this.c.editor ) {
        this._editor(null, e, true);
      }
      break;
    
  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    The idea was that if Editor isn't defined then it will fall through to the default handler allowing the key event to handle F2 if required. Good point though, I should have commented that. Added now :).

    Allan

This discussion has been closed.