0

I would like to programmatically select a cell in a Qooxdoo table widget and then start the editor for that cell.

So far, I’ve been able to figure out the following: I can select and focus the cell as follows:

var pane = table.getPaneScroller(0);
var selectionModel = table.getSelectionModel();
selectionModel.resetSelection();
selectionModel.addSelectionInterval(row, row);
pane.setFocusedCell(col, row);

However, a subsequent call to table.startEditing() will not start the cell editor. It works if the cell had manually been selected by the user.

What does the user’s selection of the cell do that my programmatic approximation fails to?

I’ve put together an example demonstrating the problem.

Raphael Schweikert
  • 18,244
  • 6
  • 55
  • 75

1 Answers1

2

I’ve been so obsessed with the startEditing not working that I failed to see the obvious: I got the focusing part completely wrong. I had copied it from an old discussion thread. Obviously, it was much too old.

Now I’m doing this:

var selectionModel = table.getSelectionModel();
selectionModel.resetSelection();
selectionModel.addSelectionInterval(row, row);
table.setFocusedCell(col, row);
table.startEditing();

Selecting the row the cell is in is not even strictly necessary but a focused cell in an unselected row looks kinda weird.

Raphael Schweikert
  • 18,244
  • 6
  • 55
  • 75