0 down vote 
favorite<http://stackoverflow.com/questions/16826291/gwt-pass-click-event-from-widget-contained-in-cell-to-the-column#>
 
  
I have a widget that I render in a GWT cell, which extends the 
AbstractCell, via the render function below. The column is created as below 
with the getValue and the FieldUpdater (update) function being defined. The 
intent is to set selected row to correspond to the clicked widget. However, 
when I click on the widget, the onBrowserEvent function of the cell is not 
called. I think this is happening because the widget in question contains a 
FlexTable within it. 

I verified this by setting a breakpoint in the function 
AbstractCellTable.onBrowserEvent2 and noticed that the function does not 
fire a cell event since the else if (section == getTableBodyElement()) 

return false. This is false because the section is a sub-section of the 
table body element corresponding to the table that I inserted via the 
widget. 

Is there a way to pass the click in the inner table (widget) to the outer 
cell table?


//Render function to add widget to cell
public void render(Context context, MyItem value, SafeHtmlBuilder sb) {
    if (value != null) {
        SafeHtml safeValue = SafeHtmlUtils.fromTrustedString(value
            .getWidget().getElement().getString());
        sb.append(safeValue);
    }
}


//Creating the corresponding column, setting up the field update, 
// and adding the column to cell table

// Create Cell
MyItemCell myItemCell = new MyItemCell();

// Create Column
Column<MyItem, MyItem> myItemColumn = new Column<MyItem, MyItem>(myItemCell) {

    @Override
    public MyItem getValue(MyItem object) {
        return object;
    }

};

// add field updater
myItemColumn.setFieldUpdater(new FieldUpdater<MyItem, MyItem>() {
    @Override
    public void update(int index, MyItem object, MyItem value) {
        // This function, for some reason, 
        // is not getting called when I click 
        // on the widget corresponding to MyItem
        MyDataTable.this.getSelectionModel().setSelected(object, true);
    }
});


// Add column to table
this.getDataTable().addColumn(myItemColumn);

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to