views:

43

answers:

1

I want to make a table of data in a UiBinder. I need programmatic access so I can add data at runtime, but I'd like my designer to have access to header names, column styles, etc, in the ui.xml file.

Is there a solution that meets these needs? A Grid perfectly satisfies my programmatic access, but I don't see a way to specify rows or cells in a Grid from the ui.xml.

+1  A: 

I'd let the designers change the style via CSS files: Either include those in your host page, or use CssResource in a ClientBundle.

The header names etc. can be provided e. g. by properties files via GWT's internationalization Constants (even if you only want to support one language).

If you want to go one step further, and let the designer specify, which columns to show, and in which order, then it might be a good idea to create your own widget. Maybe the CricketScores example serves as a good starting point on how to use an XML attribute to specify the columns from your ui.xml.

Chris Lercher
Right now I'm leaving setting each column with dummy css classes and letting my designer grep the code for them so he can see where he should change what. I think you're right that this is about as good a solution as I'm going to find with GWT right now. I was hoping for some syntax like <g:Grid><g:row><g:td styleName="whateverMyDesignerWants">Holler</g:td></g:row></g:Grid>, but it doesn't seem like anything like that is available. Thanks for the tip about Constants!
Riley