UltraWebGrid: “Invalid Argument” error after upgrade

One would think that classic UltraWebGrid control would not be touched by 2010+ Infragistics NetAdvantage upgrades, perhaps some bugs would be fixed, but definitely no new ones should be introduced – since no new development is done on the control.

One would be mistaken, The Adventure Of Upgrading liveth on.

If you’re using UltraWebGrid, and its columns’ width is set as a percentage and some columns are hidden, e.g. you have something like this:

<igtbl:UltraGridColumn Key="COL1" Width="25%" Hidden="True">
   <Header Caption="My Important Column"></Header>
</igtbl:UltraGridColumn>

And you try to unhide the column in client-side JavaScript code like this:

var oBand = igtbl_getGridById('xMyGrid').Bands[0];
oBand.getColumnFromKey("COL1").setHidden(false);

You will get an error: Invalid argument deep in the jungle of Infragistics JavaScript code. What the?! It worked fine before the upgrade!

Digging deeper into the jungle you find that the error is happening in line

co.width = cg[j].childNodes[i].oldWidth;

of function igtbl_lineupHeaders. That line is trying to assign a negative value to HTML element’s width property – hence the error. Taking birds eye view above the jungle you realize that this branch is executing only if column has a percentage width.

The solution is obvious – give all your columns pixel width instead of percentage. That is until and if Infragistics fixes this bug.

Leave a Reply

Your email address will not be published. Required fields are marked *