Menu: append item

I’m using the Menu and I’ve looked a bit to the exposed API and I can’t find a way for performing an append of an item into the menu.
I mean, I’m always able to perform an insert specifying the position, but how may I add an item to the end of a menu (or a sub menu)?

Best regards, Andrea Pirola


try addNewSibling method
menu.addNewSibling(previousId, itemId, itemText, false);

here is the sample dhtmlxMenu/samples/01_init/03_init_from_script.html

mmmmm… It’s not really what I need, because it requires that I know the previousId of the element. Is there really no way to know how many buttons have already been inserted in a Menu / Submenu? I mean, I know I could iterate over them and calculate the result, but is there no more straightforward way to do that?

Best regards, Andrea Pirola

There is forEachItem method: