PDA

View Full Version : appendChild Bug



lalogrosz
4 Jul 2007, 5:42 AM
Hello, I have a problem when I execute the appendChild function...

tabs = Ext.get("tabsP");
divEl = new Ext.Element("div");
divEl.id = 'tabP'+id_sd.substring(10);
tabs.appendChild(div);

uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.appendChild]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://portaltunes/js/ext-1.0.1/ext-all.js :: anonymous :: line 19" data: no]

I get the tabs element(div) and I create the divEl setting the id, but this fail in the appendChild function.

Why??
Thanks ;)

liggett78
4 Jul 2007, 5:55 AM
You can't create and insert new DOM elements with Ext.Element, use Ext.DomHelper.append().

mystix
4 Jul 2007, 6:35 AM
You can't create and insert new DOM elements with Ext.Element, use Ext.DomHelper.append().

actually, you can, using an Ext.Element's createChild() (http://extjs.com/deploy/ext/docs/output/Ext.Element.html#createChild) method, but definitely not via lalogrosz's method.