7

I noticed that vaadin 6.7.0 beta1 supports to add tooltip for row/cell of a table. However, I did not find any example how to add it. Is there anybody who can provide some sample?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Kyleinincubator
  • 313
  • 1
  • 5
  • 12
  • I don't believe that the code for tool tips is currently in the 6.7.0-beta1 jar thats available. I to am interested in this, and I down loaded the jar. The info given in bug http://dev.vaadin.com/ticket/5414 suggests what the methods should be, but they don't seem to be present – nuzz Sep 28 '11 at 01:36

3 Answers3

9

Use code as below:

table.setItemDescriptionGenerator(new ItemDescriptionGenerator() {                             
public String generateDescription(Component source, Object itemId, Object propertyId) {
    if(propertyId == null){
        return "Row description "+ itemId;
    } else if(propertyId == COLUMN1_PROPERTY_ID) {
        return "Cell description " + itemId +","+propertyId;
    }                                                                       
    return null;
}}
daniilyar
  • 2,602
  • 3
  • 22
  • 25
  • It seems that this is only working for non editable tables. If make my table editable the tooltip/description disapears. – Hajo Thelen Sep 07 '12 at 06:46
1

You could accomplish this by setting a formfieldfactory. Here you could return a button that only loooks like text with styling CSS. This will let you set a caption on the button. This is obviously a ugly hack. More info about buttons and links in vaadin.

table.setTableFieldFactory(new TableFieldFactory() {

            // container is the datasource
            // item is the row
            // property  is the column
            //
            @Override
            public Field createField(Container container, Object itemId, Object propertyId, Component uiContext) {

        })
Marthin
  • 6,413
  • 15
  • 58
  • 95
0

You can't add tooltpis (setDescription) to a row/cell nativly - not yet! It is already in there issue tracker but don't know when they will implement this feature

Matthias Bruns
  • 899
  • 8
  • 13