Topic: MifMenu - update of tree structure

moro,

Suppose I initialize context menu with one element:

list: {
    items: [
    {
        name: 'new: ONE',
        onAction: function(){
            alert('new');
            }
        }
    ]
}

It is attached to a DIV element (displayed on left-click), showing and works fine.

Now, I need to replace 'new: ONE' with 'new: TWO' element:

items: [
{
    name: 'new: ONE',
    onAction: function(){
        alert('new');
        }
    }
]

How can I do it without totally re-instantiating the whole class. Is there a method to "update" the existing menu based on new 'list' parameter?

For example, I need to update menu items based on a state of other page components. If there's more that one item selected on the page - menu should have "DELETE ALL" entry dynamically inserted after "DELETE".

Thanks