Fabrizio Guespe
Fabrizio Guespe

Reputation: 603

RightClick CellTable Header

I need to make the column headers of my celltable to do something on right click.

I implemented a header which uses by now a clickabletextcell, but can be anything.

here is how I declare my celltable so far:

Header header = new Header(new ClickableTextCell()) {

    @Override
    public String getValue() {
        return actual.getCaption();
    }
};
    
        
TextColumn<ObjetoDato> columna = new TextColumn<ObjetoDato>() {
    
    @Override
    public String getValue(ObjetoDato origen) {
        return origen.getValor(actual.getNombreCampo());
    }
};
columna.setSortable(true);
sortHandler.setComparator(columna, new Comparator<ObjetoDato>() {
    @Override
    public int compare(ObjetoDato o1, ObjetoDato o2) {
      return o1.getValor(actual.getNombreCampo()).compareTo(o2.getValor(actual.getNombreCampo()));
    }
});
table.addColumn(columna,header );

Upvotes: 0

Views: 161

Answers (1)

maneesh
maneesh

Reputation: 1701

Check out the click sample here https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCustomCells#cell-onBrowserEvent In your case after you confirm its a "click" event, you can figure out the left/right by using the NativeEvent#getButton()

Upvotes: 1

Related Questions