Page 1 of 1

Changing UI dropdown list

Posted: April 20th, 2010, 3:39 am
by benroll
Hi All,

I'm trying to make a UI where there are two drop down lists. The contents of the second drop down list needs to alter, according to what is selected in the first. Most of the standard Javascript array syntax I've tried doesn't work. Then I found this in another script...

pal.grp.main.aDropDown.add('item', 'hello');

...which successfully adds 'hello' to the end of the list. I extrapolated the syntax to....

pal.grp.main.aDropDown.remove('item', pal.grp.main.aDropDown.items[0]);

...and although it doesn't through an error, it doesn't have any effect either. I've tried setting the length to 0, using splice() and pop() etc. but all to no avail. Now I'm stumped.

How do I do this?

Thanks if you can help.

Ben.

Re: Changing UI dropdown list

Posted: April 20th, 2010, 3:41 am
by benroll
Just found it!

pal.grp.main.aDropDown.remove(pal.grp.main.aDropDown.items[0]);

But if anyone can think of a nice succinct method to empty the list... or just set it to another list that doesn't use a loop and remove() to get rid of the elements one by one, I'd love to know about it.

Thanks.

Ben.

Re: Changing UI dropdown list

Posted: April 20th, 2010, 9:01 am
by Dan Ebberts
Did you try .removeAll() ?


Dan