Hi!
I think most of you went through GWT Get Started material. It was
based on StockWatcher project example.
One detail there which doesn't let me complete it.
The code which adds ClickHandler to button which removes Stock item
from the table. For each row this button is dynamically added. The
code is following:
private void addStock(){
final String symbol =
newSymbolTextBox.getText().toUpperCase().trim();
.....
Button removeStockButton = new Button("x");
removeStockButton.addStyleDependentName("remove");
removeStockButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
int removedIndex = stocks.indexOf(symbol);
stocks.remove(removedIndex);
stocksFlexTable.removeRow(removedIndex+1);
}
});
....
}
The thing that is not clear, how will be 'symbol' variable resolved in
ClickHandler when actually the click will happen on remove button?! It
was declared in another class method, which took place when stock was
added, so it won't be accessible any more, particularly when sometime
onClick() event will take place...
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.