PDA

View Full Version : Element.id not set on each() in Ext 1.1



niemeyer
12 Jun 2007, 2:39 PM
Hello folks,

Not sure if that was reported before. I've got a simple each() call like:

Ext.select("tr").each(function(row) { console.log(row.id); });

and that is printing "undefined", rather than the element id. Doing
row.dom.id will show the correct id. This code is inside a onReady()
event, FWIW.

tryanDLS
12 Jun 2007, 3:06 PM
That's b/c you're creating flyweight objects, rather than fully constructed Elements. If you pass true as the 2nd arg to select, it will create Elements and assign the id property. See the doc for Element.select for more.

niemeyer
13 Jun 2007, 7:36 AM
Understood. If that behavior is expected, I suggest adding a short note to the documentation of Element.id.

Thanks for the very quick answer.