enable and disable checkBoxCells in a a Celltable

2,454 views
Skip to first unread message

pfc09 pfc09

unread,
Dec 14, 2010, 2:54:10 AM12/14/10
to google-we...@googlegroups.com
Hi!
I'm working with a CellTable and I'd like to add checkBoxCells to a column. I only would like to enable some checkBoxes, how can I disable or enable checkboxes in a cellTable?

Thank you!

Subhrajyoti Moitra

unread,
Dec 14, 2010, 7:10:02 AM12/14/10
to google-we...@googlegroups.com
i think u will have to use AbstractCell and then implement the render method appropriately.
Also see the sources for CheckBoxCell for an example.

Thanks,
Subhro.

--
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.

pfc09 pfc09

unread,
Dec 14, 2010, 5:34:03 PM12/14/10
to google-we...@googlegroups.com
Hei! And thank you for answering.
I read what you suggested, but I can't see how render method can help me... 
void render(C value,
java.lang.Object key,
SafeHtmlBuilder sb)

could you suggest me how to act?
Thank you!


2010/12/14 Subhrajyoti Moitra <subhra...@gmail.com>

John LaBanca

unread,
Dec 14, 2010, 9:29:17 PM12/14/10
to google-we...@googlegroups.com
Cell#render() renders the Cell contents as Html into the SafeHtmlBuilder.  If you create your own CustomCheckboxCell, you can render a checkbox however you want.

You're render method would look something like the following:
void render(MyType value, Object key, SafeHtmlBuilder sb) {
  if (value.isDisabled()) {
    sb.appendHtmlConstant("<input type='checkbox' disabled=disabled></input>");
  } else {
    sb.appendHtmlConstant("<input type='checkbox'></input>");
  }
}

Thanks,
John LaBanca
jlab...@google.com

pfc09 pfc09

unread,
Dec 15, 2010, 4:12:48 AM12/15/10
to google-we...@googlegroups.com
OK, I see!
Thank you very much :)

2010/12/15 John LaBanca <jlab...@google.com>
Reply all
Reply to author
Forward
0 new messages