GwtMaterialDesign / gwt-material-table

A complex table component designed for the material design specifications
https://gwtmaterialdesign.github.io/gmd-table-demo/
Apache License 2.0
27 stars 31 forks source link

onBrowserEvent is not called on columns with custom cells #114

Open pfacmf opened 7 years ago

pfacmf commented 7 years ago

I created a column with the constructor gwt.material.design.client.ui.table.cell.Column.Column<T, String>(Cell<String> cell) but the onBrowserEvent is not called on my cell. As far as I could trace void gwt.material.design.client.ui.table.cell.Column.onBrowserEvent(Context context, Element elem, T object, NativeEvent event)is calling my cell's onBrowserEvent but this method is only referenced in <C> void gwt.material.design.client.ui.table.AbstractDataTable.fireEventToCell(Event event, String eventType, Element parentElem, T rowValue, Context context, HasCell<T, C> column), which is not called anywhere.

My cell is calling super("click", "keydown"); in constructor.

FieldUpdater set on the column is not called either clicking the cell. I tested this on a TextColumn and on a Column with my custom Cell.

I am using 2.0-rc6

BenDol commented 7 years ago

Right now the onBrowserEvent is actually only partially supported. The idea is that we won't have a need for the typical GWT way of catching column/row events. Instead what can be done is you setup handlers for the widgets inside the cells:

table.addColumn(new WidgetColumn<Person, MaterialButton>() {
            @Override
            public MaterialButton getValue(Person object) {
                MaterialButton button = new MaterialButton();
                button.setText(object.getFirstName());
                button.addClickHandler(e -> MaterialToast.fire("Clicked " + object.getFirstName()));
                return button;
            }
        });

I plan on getting the onBrowserEvent way working to improve performance for some users in the future. Also would love to accept community help if there is a real need for it on your end.