PDA

View Full Version : button's menu contents not rendered until button is clicked



cankut
12 Dec 2013, 1:06 PM
I have a simple button with menu. There is a treepanel inside the menu.


Whenever user selects some node in tree, i update the container buttons text.


In treepanel's afterrender event i make a default node selection in the tree and this fire selection event and the button's text is updated.


However, when the button is rendered for the very first time, the treepanel inside the menu is not yet rendered.


How can i make menu & treepanel render silently (adding to dom but not shown to user until button is clicked) after button is rendered?


Actually there is a workaround which i hesitate to use:



btn.showMenu();
btn.hideMenu();


Any better ideas?


JsFiddle: http://jsfiddle.net/exGk3/

Kevin Jackson
17 Dec 2013, 8:44 AM
What OS and browser are you seeing it in? Could you send a code example so I can see how you have it set up in https://fiddle.sencha.com/#home. Sounds like that is where your error is.

cankut
17 Dec 2013, 2:41 PM
What OS and browser are you seeing it in? Could you send a code example so I can see how you have it set up in https://fiddle.sencha.com/#home. Sounds like that is where your error is.

Kevin,

I already posted the example code in my first post. I'm using Chrome on Windows 7.

See it here: http://jsfiddle.net/exGk3/

cankut
19 Dec 2013, 5:03 AM
Kevin,See also: https://fiddle.sencha.com/#fiddle/2a4

jfenety
19 Mar 2014, 9:18 AM
Hey,

I have run into this problem as well. Does anyone have a solution. The menu doesn't actually get rendered to the DOM until after you have clicked/highlighted a submenu on it. I have tried loading the menu (store and create structure) and then manually rendering it, which works fine, but I would need to do this for all submenus as well. Which seems like a pain.

Any thoughts?

jfenety
19 Mar 2014, 9:34 AM
Here is an example:

https://fiddle.sencha.com/#fiddle/4cd

As you can see when inspecting the HTML, the menu does not get rendered to the DOM until after you click the menu button or highlight a submenu.