CellTable CheckboxCell setTitle()

208 views
Skip to first unread message

Vivek Dudani

unread,
Dec 23, 2011, 7:02:28 AM12/23/11
to Google Web Toolkit
Hi,

I need to set tooltip for CheckboxCell which i'm adding in a
cellTable.
created a new CheckboxCell and then added it to CellTable header.

cannot find any setTitle or anything else.
Even tried with below code :

public void setTitle(String title){
if (title == null || title.length() == 0) {
DOM.removeElementAttribute(getElement(), "title");
} else {
DOM.setElementAttribute(getElement(), "title", title);
}
}

private Element element;

public com.google.gwt.user.client.Element getElement() {
return (com.google.gwt.user.client.Element) element;
}

This too didn't worked.
Can somebody please help me out on this.

Best Regards,
Vivek Dudani

Ed

unread,
Dec 23, 2011, 7:33:49 AM12/23/11
to google-we...@googlegroups.com
Override the method CheckboxCell.render(..) and add the title attribute as a string (see source of CheckboxCell).

CheckboxCell is part of the CellWidget family and don't extend from Widget, which make them fast and lightweight.

Because they don't extend from Widget that don't have methods like setTitle. 
If you want to use a setTitle() method, then use the CheckBox widget.



Vivek Dudani

unread,
Dec 26, 2011, 3:35:25 AM12/26/11
to Google Web Toolkit
Hey, thanks a lot Ed.
It worked.

Ed Bras

unread,
Dec 26, 2011, 6:54:38 AM12/26/11
to google-we...@googlegroups.com
Good to hear :)


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Vivek Dudani

unread,
Dec 26, 2011, 8:18:48 AM12/26/11
to Google Web Toolkit
Hey,

can u help me out with one more issue..
I need to add title for each row as "Select row 1", "Select row 2"...
and so on.
can we put some dynamic string inside title attribute that will show
row number in title(i.e. tooltip) for each row or any other way of
achieving it?

Please workaround if any.

Thanks,
Vivek

divStar

unread,
Dec 26, 2011, 10:18:23 AM12/26/11
to Google Web Toolkit
Hey Vivek,

this might be relevant for you:

http://groups.google.com/group/google-web-toolkit/browse_thread/thread/512c65f0f8a3d0bc/cec88ea01013338c?lnk=gst&q=celltable+title#cec88ea01013338c
---
In GWT 2.5, you'll be able to provide your own CellTableBuilder
(you'll
probably subclass the DefaultCellTableBuilder) and add a title=""
attribute
on any <tr> or <td> you'd like.
---

I suppose using this CellTableBuilder you could make it so that each
row has a certain title assigned to it (even though I'm not sure,
whether TR-elements are even allowed to have a title-attribute at
all). I didn't try it myself, since I'm still on 2.4. But I moved my
requirement of having this to a different milestone. Therefore I'll
implement the titles when I get to reworking my application once GWT
2.5 is out.

Greetings,
Igor.
Reply all
Reply to author
Forward
0 new messages