netzke / netzke-core

Framework for Sencha Ext JS + Ruby on Rails client-server components
http://netzke.org
Other
263 stars 77 forks source link

Actions can not be added to menu #81

Open szpapas opened 8 years ago

szpapas commented 8 years ago

http://www.rubydoc.info/github/netzke/netzke-core#Actions__toolbars__and_menus

Actions can also be referred to is submenus: c.tbar = [{text: 'Menu', menu: {items: [:show_report]}}]

I played with netzke-demo, and change the Applcaction.rb title_html to menu like this:

tbar: [{text:'Menu', menu: {items: [:about]} },'->', :about, current_user ? :sign_out : :sign_in],

The dropdown menu displayed without any text and can not response to the click events.

When viewed source in chrome, I got :

Ext.onReady(function(){
Netzke.page.application = Ext.create("widget.application", {"className":"Application","name":"application","introHtml":"Click on a demo component in the navigation tree",
"items":[{"layout":"border","tbar":[{"text":"Menu","menu":{"items":[{"action":"about"}]}},"-\u003e",{"action":"about"},{"action":"signIn"}],"items":[{"region":"west","itemId":"navigation","width":300,"split":true,"xtype":"treepanel",
mxgrn commented 8 years ago

If you replace menu: {items: [:about]} with menu: [:about] it'll work. I guess I didn't pay enough attention to the fact that, besides specifying items as an array, one may want to configure other aspects of the menu. Need to look into this again, thanks for reporting!