Saturday, December 20, 2014

Tricky DataGrid Live Update Question

Working on a stock market system, I've implemented a data grid that shows the open positions for a trader. That grid has a number of columns showing current price fluctuations which might change as many as 20 times a second. There is also a column containing a "close position" button pressing which causes the position to be closed. The smallest resolution GWT provides for grid update is redrawRow(int row). That's what I use to update the grid with live data.

The problem I have is that redrawRow() sometimes cancels close button events. To put it more precisely, if a user presses and holds the close button pressed for a while, and then releases it, the event will be lost if redrawRow has been invoked for the same row. That is reported as "very annoying" by most users, and we are failing to come up with a workaround to solve it. Do you have any idea how to solve this issue?

Below is how we create the close button cell:

private static ButtonCell closeButton = new ButtonCell(){
private String imageResource = new Image(FxResources.INSTANCE.closePosition().getSafeUri()).toString();
private SafeHtml html = SafeHtmlUtils.fromTrustedString(
"<button type=\"button\" class=\"gwt-Button\">" + imageResource + "</button>");
public void render(
final Context context,
final SafeHtml data,
final SafeHtmlBuilder sb) {

Adding the button cell to a column and wiring it up:

final Column<MarketOrderDTO, String> closeColumn = new Column<MarketOrderDTO, String>(closeButton) {
public String getValue(MarketOrderDTO mo) {
return "";
.setFieldUpdater(new FieldUpdater<MarketOrderDTO, String>() {

public void update(int index, MarketOrderDTO mo, String value) {
.addColumn(closeColumn, "");


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment