0 Replies Latest reply on Oct 18, 2012 9:11 AM by 969190

    Edit TableCell in TableView right after it has been added to the data list

    969190
      Hi all

      I'm trying to make my table view editable by keyboard. So far I can edit the currently selected cell with a press of 'E'. That works without any problems:
      table.edit(selectedRow, tableColumns.get(0));
      Now I want to add functionality for adding a new row with the press of 'N'. So when pressing 'N' I add a new Object to my data list and try to get into editing mode the same way I do it when pressing 'E', but it won't work.

      My first try was like this:
      data.add(new Task("", "0"));
      table.edit(data.size() - 1, tableColumns.get(0));
      The new row gets created but I won't get the edit text field. That's why I tried to focus and select the newly created cell. The focus and selection work, but I won't get an edit field.
      int lastRow = data.size() - 1;
      data.add(new Task("", "0"));
      table.getFocusModel().focus(lastRow);
      table.getSelectionModel().select(lastRow, tableColumns.get(0));
      table.edit(lastRow, tableColumns.get(0));
      It may have something to do with the fact that the new row just got inserted... I don't know :/


      I'd appreciate some hints on this :)

      Thx