setWidth on Grid.Column - negative value

In the API it says that if I use the method Grid.Column.setWidth with a negative number, the column will resize to adapt to the content, but when I do it I get an IllegalArgumentException.

Is the API wrong? Am I doing something wrong? How can I make the columns of a Grid go back to the default (adapted to the content) after I’ve been resizing them in the browser?

Thanks

No, API should not be wrong. There are two possibilities, for some reason your system is not interpreting the value you have as negative double, or this is a bug.

I’ve checked the code in setWidth and it clearly says that if the valie is negative should throw and exception.

Anyway, I found a method that can be better for my needs, setWidthUndefined, which should change the witdh of the column depending on the content. The problem is that this does not really work well for me. The columns don’t get the same same width as when I first visit the view with the Grid. Actually one of the longest gets reaaaally narrow.
What could provoke this behaviour?

Yes, you are right. Also JavaDoc states the following. I will report this.

"Sets the width (in pixels).

This overrides any configuration set by any of setExpandRatio(int), setMinimumWidth(double) or setMaximumWidth(double).

Parameters:
pixelWidth the new pixel width of the column
Returns:
the column itself
Throws:
IllegalStateException - if the column is no longer attached to any grid
IllegalArgumentException - thrown if pixel width is less than zero"