PDA

View Full Version : Unhelpful exception when using Grid



paulsschwarz
30 Aug 2008, 1:59 PM
- Detailed description of the problem
You happily set up your columns like this:


columns.add(new ColumnConfig("location", "Location", 150));
columns.add(new ColumnConfig("description", "Description", 100));
and then accidentally you call setAutoExpandColumn on a column that doesn't exist like this


grid.setAutoExpandColumn("locationnn");
instead of getting a meaningful exception in the hosted mode shell you get:
java.lang.ArrayIndexOutOfBoundsException: -1
with no meaningful stack trace so it ends up wasting a bit of time looking for the error.

- GXT version
1.1 alpha 2

Would be easy and awesome to translate or pre-empt the exception so we save time debugging. Thanks!

gslender
30 Aug 2008, 4:38 PM
even smarter would be making setAutoExpandColumn require a ColumnConfig and internally the id is extracted and used - thus solving this problem at compile time ;-)

I'd even go as far as extracting getID (and others) into an interface (IColumn) and having ColumnConfig implement that and make grid column methods act on the interface