Topic: in the latest Mif.Menu how can I create a dynamic menu on show event

Hello,

In the old  Mif.Menu I used  onShow to create dynamic menu on the fly.

With the code below It doesn't works :

        contextMenu = new Mif.Menu({
            onShow: function(e) {
                    var widget, target = e.target;

                        if  (widget.getContextMenu) {
                                                     // getContextMenu method return json structure compatible with Mif.menu
                                                     this.load( widget.getContextMenu() );
                        }
                    }
                }        
        
            }).attach('pageWrapper').load([
                {
                    name: 'test'
                }
            ])

Note that   If menu is empty 'show' event is never called and load method call into onShow trigger
don't do nothing because menu is already loaded.

What is the solution to achieve this ?

I've created another post related indirectly to this issue bease show event doesn't send context event when fired :

http://mifjs.net/forum/topic/203/

Thank you

Last edited by scramatte (2010-03-06 23:18:48)

Re: in the latest Mif.Menu how can I create a dynamic menu on show event

I've partialy resolved the issue firing  onBeforeShow event into  show method.