On Sun, Jul 17, 2011 at 15:17, kiran babu <[email protected]> wrote:
> Hi,
>
> This is my 10 attempt to build a framework based on qooxdoo(in 3 yrs), hope
> this time i will be successfull (i think i am doing pretty well), any way
> right now i have a problem i have the following set of lines in the code
> which works fine in the source version
>
> for ( var iterable_element in res) {
>
> alert(iterable_element);
> var tempItem = new
> qx.ui.form.ListItem("", "test/icons/users.png");
> tempItem.setLabel(iterable_element);
> tempItem.set("userid",
> res[iterable_element]);
> this.__usersList.add(tempItem);
> }
>
>
> but when i build the same source it dosent enter the loop at all in the
> build version, kindly give me advise on how to work with associative arrays
> in qooxdoo, if it works in source why is it not working in the build
> version.
>
You aren't showing us what value res has, but if it in fact an array, your
usage is incorrect to start with. There is no such thing as an associative
array in JavaScript. You can attempt to use an array in such a way, but
there all kinds of cross-browser differences. The for..in construct is not
for use with arrays at all; it's for use with maps (objects).
So... What is the type and value of res? If it's an array, then either use a
for (i=0; i<res.length; i++) loop, or use res.forEach(func) to iterate
through the array.
Cheers,
Derrell
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel