Fred
Fred

Reputation: 309

Is it possible to set the column width of a grid in GWT using uibinder?

I'm trying to use the GWT grid component in uibinder. It works fine until I want to set the width of the columns. The following is what I've tried to do but it doesn't seem to work.

        <g:Grid width="100%">
        <g:row>
            <g:customCell width="20%">
                <g:FlowPanel width="">
                </g:FlowPanel>
            </g:customCell>
            <g:customCell width="80%">
                <g:FlowPanel width="">
                </g:FlowPanel>
            </g:customCell>
        </g:row>
    </g:Grid>

Upvotes: 3

Views: 6270

Answers (2)

the
the

Reputation: 71

You can write some java code in order to do that, example:

    grid.getColumnFormatter().setWidth(0, "10%");
    grid.getColumnFormatter().setWidth(1, "10%");

Upvotes: 7

Thomas Broyer
Thomas Broyer

Reputation: 64561

Only styleName is taken into account on g:row, g:cell and g:customCell elements.

If you can (i.e. if your grid content is mostly static), avoid using Grid and prefer an HTMLPanel containing an HTML <table>, this gives you much more flexibility.

http://code.google.com/p/google-web-toolkit/source/browse/tags/2.4.0/user/src/com/google/gwt/uibinder/elementparsers/GridParser.java

Upvotes: 3

Related Questions