Hi,
I want to display some values in a Table with only one column. If the user clicks on a row, the particular cell in this row shall be made editable. I achieved this (or at least I think this should work) by using a special TableItem: it contains a container with a CardLayout that holds a TextField (for editing) and a Text (to display the value). The idea is that the CardContainer switches the displayed Widgets on the Event CellClick:
Code:
final Object[] cellItems = new Object[table.getColumnCount()];
// Container to swap the displayed Widget
final CardContainer cardContainer = new CardContainer();
//Widget for editing
final TextField textField = new TextField();
textField .setFieldLabel(null);
textField .setValue("Some String");
cardContainer.add(textField );
// add simple Text
cardContainer.add(new Text("Some String"));
cellItems[0] = cardContainer;
final TableItem item = new TableItem(cellItems);
table.addListener(Events.CellClick, new Listener<BaseEvent>() {
public void handleEvent(final BaseEvent be) {
//For the moment, the swapping is not realized yet. But the method seems not to be called.
cardContainer.setVisible(textField );
}
});
table.add(item);
For some reason, the Event seems not to be fired. How do I have to add the listener that I can handle CellClick-Events? Registering them at the TableItem didn't work either.
Using GXT Beta 3 and GWT Milestone 2 in Hosted Mode.
Cheers,
Flo~