Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Àlex Corretgé on Feb 20, 2008 02:55
open dhtmlx forum
forEach menu items

Is there a method to read all items of a menu?

The lenght property always is Zero and i can't use the forEach method:

aMenu.menu.forEach(contextMenu_proc);

And this function

    function contextMenu_proc(element, index, array)
     {
                    if(element == opcioContextMenu)
                    {
                        aMenu.menu.getItem(element).imageTag.src='/BUWE/BPPE/common/imatges/iconCheckAll.gif';
                    }
                    else
                    {
                        aMenu.menu.getItem(element).imageTag.src='/BUWE/BPPE/common/imatges/iconUnCheckAll.gif';
                    }
                   
      }



Thanks for all
Answer posted by Support on Feb 20, 2008 05:18
There is no built-in iterator, but you can use next code

for (var i=0; i<aMenu.menu.gitems.length; i++){
    var id = aMenu.menu.gitems[i].id;
    ... any custom code here...
}
Answer posted by Àlex Corretgé on Feb 20, 2008 06:56
Oh! Fantastic its just that I want :-)

gitems!

Best Regards
Àlex Corretgé