Wednesday, September 23, 2015

Celltable w/SelectionModel not firing onSelectionChange event

I have a CellTable that doesn't seem to want to follow my defined SelectionModel. I know I must be missing something dumb, does anyone see what I've done wrong here?

public class QuoteTable extends CellTable<QuoteListProxy> {
Column<QuoteListProxy, Long> editColumn;
Column<QuoteListProxy, String> quoteColumn;
Column<QuoteListProxy, String> referenceColumn;
Column<QuoteListProxy, Date> dateColumn;
Column<QuoteListProxy, String> contactColumn;
Column<QuoteListProxy, QuoteListProxy> summaryColumn;
ListHandler<QuoteListProxy> columnSortHandler;
QuoteSearchSnapshot quoteSearchSnapShot;

public final static String QUOTE = "Quote#";
public final static String REFERENCE = "Reference";
public final static String CONTACT = "Contact";
public final static String QUOTE_DATE = "Date";

final SingleSelectionModel<QuoteListProxy> selectionModel = new SingleSelectionModel<QuoteListProxy>();

public QuoteTable() {
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
    @Override
       public void onSelectionChange(SelectionChangeEvent event) {
    QuoteListProxy selected = selectionModel.getSelectedObject();
         if (selected != null && quoteSearchSnapShot != null) {
         quoteSearchSnapShot.loadSnapShot(selected);
         }
      }
   });
initTable();
this.setSelectionModel(selectionModel);
}

private void initTable() {
//setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
initColumns();

for (int i = 0; i < this.getColumnCount(); i++) {
Column c = this.getColumn(i);
if (c.isSortable()) {
this.getHeader(i).setHeaderStyleNames("sortableColumn");
}
}
}

My initColumns() builds out a few TextCells and a few ActionCells. I know that the SelectionModel will always fire, even when an ActionCell is clicked, and that is the behavior I want but the SelectionChange event does not ever seem to get triggered. When I debug, I never even hit the breakpoint I have set in the onSelectionChange() method I've defined. Any insight would be appreciated? :)

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment