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.

4

1 回答 1

2

我一直痴迷于startEditing不工作,以至于我没有看到明显的:我完全弄错了聚焦部分。我从一个旧的讨论线程中复制了它。显然,它太旧了。

现在我正在这样做:

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

选择单元格所在的行甚至不是绝对必要的,但未选择行中的焦点单元格看起来有点奇怪。

于 2012-12-14T13:00:57.907 回答