Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Charles McPhate on Nov 04, 2009 13:53
open dhtmlx forum
Invalid Argument

Using dynamic smart rendering, I get an "Invalid Argument" with IE8 on this code in dhtmlxgrid.js:

    this.hdr.rows[0].cells[i].style.width=this.cellWidthPX[i]+"px";

I've determined it's not from having a width attribute in my XML header columns:

    <column type="dyn">
    
If I put width="some number" in the column tag, then it works, but it sets a specific width rather than dividing the columns evenly.

This is not a problem in Firefox, just Internet Explorer.
Answer posted by dhxSupport on Nov 05, 2009 05:52
>>I've determined it's not from having a width attribute in my XML header columns

Each <column> tag must have width atrribute. Otherwise IE will return Invalid Argumetn error. 
You can use setInitWidthsP() method to set column width in percents. Please find example here http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/10_grids_manipulations/08_pro_resize.html

Answer posted by Charles McPhate on Nov 05, 2009 09:47
The only problem is that it appears setInitWidthsP() is used when you know how many columns are going to be in the grid. I want to be able to use the same HTML for reports from multiple tables, so I won't always have the number of columns. My XML is used to set the column headers and determine the number of columns.

Firefox works as I expected it to -- it didn't encounter column widths in the XML, so it spread them out evenly across the grid. It's only Internet Explorer that threw an error.

Attachments (2)
Answer posted by Charles McPhate on Nov 05, 2009 09:57
Also, when I run this from IE without column widths, it displays the column header row just as it does in Firefox -- spread evenly across the grid width. It's only after displaying the header row that it throws the error.
Answer posted by Charles McPhate on Nov 05, 2009 10:14
FYI, my company just registered the Enterprise version. I can provide our registration number now if you need it.
Answer posted by Alex (support) on Nov 06, 2009 08:52

Hello, 

you can try to set * as a width for each column. In this case the width will be calcilated automatically:

<?xml version="1.0"?><rows total_count='1000' pos='0'> <head><column type='dyn' width="*">Cust#</column><column type='dyn' width="*">Invoice #</column>.....<column type='dyn' width="*">Unit Price</column></head> ..... 

Answer posted by Charles McPhate on Nov 06, 2009 09:23
Worked perfectly! Many thanks!