CellTable question

52 views
Skip to first unread message

GeorgeS

unread,
Jul 27, 2011, 3:44:46 PM7/27/11
to Google Web Toolkit
I'm working on an GAE app using GWT and I'm running to a problem using
CellTable. I don't know until run time how many columns are needed and
their type in my CellTable (Note: there are always two fixed columns)
so I can't just hook up the columns at design time. The values I'm
reading are currently three strings where the third string gets parsed
into however many columns I need (just a simple split into a String
[]). Is there a way to do this? I'm still learning Java so I'm
thinking there is some very simple way that I haven't discovered.

GeorgeS

unread,
Jul 28, 2011, 11:52:23 AM7/28/11
to Google Web Toolkit
I see mention of a DataGrid in 2.4? Is there any documentation on this
yet?

Magno Machado

unread,
Jul 28, 2011, 1:22:28 PM7/28/11
to google-we...@googlegroups.com
You just have to read whatever information you need and then just call yourCellTableInstance.addColumn(...) as needed

On Thu, Jul 28, 2011 at 12:52 PM, GeorgeS <sxou...@gmail.com> wrote:
I see mention of a DataGrid in 2.4? Is there any documentation on this
yet?

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




--
Magno Machado Paulo
http://blog.magnomachado.com.br
http://code.google.com/p/emballo/

GeorgeS

unread,
Jul 28, 2011, 1:55:20 PM7/28/11
to Google Web Toolkit
I think what I'm not understanding is how to create the getValue
portion of the column creation before I add the column to the cell
table when it isn't pre-defined. When I have code like:

TextColumn<ResultDocument> fieldsColumn = new
TextColumn<ResultDocument>() {
@Override
public String getValue(ResultDocument resultDoc) {
return resultDoc.documentFields;

}
};

I can see easily what to do but when that column is accessing the (for
example) 8th value in a String [] then I can't see it. This is
probably my newness to Java (again).


On Jul 28, 12:22 pm, Magno Machado <magn...@gmail.com> wrote:
> You just have to read whatever information you need and then just call
> yourCellTableInstance.addColumn(...) as needed
>

GeorgeS

unread,
Jul 28, 2011, 2:00:43 PM7/28/11
to Google Web Toolkit
To clarify... there are 1-n entries where I have no what n is until
runtime so I can't hardcode stringValue[8]...

Jeff Larsen

unread,
Jul 28, 2011, 2:27:45 PM7/28/11
to google-we...@googlegroups.com
when you build the column, specify the number

MyTextColumn extends TextColumn<String[]>{

public MyTextColumn(int index){ 

  this.index = index;
}


public String getValue(String[] strings){
  return strings[index];
}

GeorgeS

unread,
Jul 28, 2011, 3:09:41 PM7/28/11
to Google Web Toolkit
Thanks... I think that what I was looking for. I had also thought of
creating an array of TextControls but this looks much cleaner.

GeorgeS

unread,
Jul 29, 2011, 9:32:54 AM7/29/11
to Google Web Toolkit
Jeff, that worked like a charm! Thanks for helping me make it up the
Java curve!


On Jul 28, 1:27 pm, Jeff Larsen <larse...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages