vdhanda
16 Oct 2008, 11:46 AM
I want to set a tooltip on a grid cell. The best I can come up with is using a GridCellRenderer and returning a SPAN element. Is there a better approach?
ColumnConfig description = new ColumnConfig("description", "Description", 150);
description.setRenderer(new GridCellRenderer<BeanModel>(){
public String render(BeanModel model,
String property,
ColumnData config,
int rowIndex,
int colIndex,
ListStore<BeanModel> store) {
String value = model.get(property).toString();
if ( value != null) {
StringBuilder html = new StringBuilder();
html.append("<span title='");
html.append(value);
html.append("' >");
html.append(value);
html.append("</span>");
value = html.toString();
}
return value;
}
});
ColumnConfig description = new ColumnConfig("description", "Description", 150);
description.setRenderer(new GridCellRenderer<BeanModel>(){
public String render(BeanModel model,
String property,
ColumnData config,
int rowIndex,
int colIndex,
ListStore<BeanModel> store) {
String value = model.get(property).toString();
if ( value != null) {
StringBuilder html = new StringBuilder();
html.append("<span title='");
html.append(value);
html.append("' >");
html.append(value);
html.append("</span>");
value = html.toString();
}
return value;
}
});