Dojo.attr() doesn’t work as expected in IE
Stop me if you’ve heard this before: a cross-browser solution doesn’t work in IE. (For a recap on my feelings about the browser, feel free to review this post).
I tried to take a solution that I posted recently to fix category indenting in a view panel with a totals column and apply it to a test database and I noticed that it didn’t work in IE 9. (I didn’t test other versions.)
It found the category rows and removed the empty cells, but didn’t indent properly. It worked fine in Firefox and Chrome (where I was testing when I figured it out and wrote the original post). By displaying the outerHTML property of the category nodes, I was even able to verify that the colspan attribute was technically there, but it just didn’t take effect.
I tried using dojo.attr() to set attributes of other elements and had no success. It seems that the method just doesn’t work well in IE.
To make the code work cross-browser, all I had to do was change line 24 in the last code block on the last post from this:
dojo.attr(nodeCat, 'colspan', 1+emptyCells);
nodeCat.colSpan = 1+emptyCells;
Now it works in IE, Firefox, and Chrome!