Sencha Touch: Panel.hide()/show() works only after resize

本秂侑毒 提交于 2020-01-24 01:20:14

问题


Here's a demo app: demo Sencha Touch app. The button in the bottom-left corner should show/hide the menu panel on top of the "Location info goes here" bar, however, it works in a strange way.

Here's how (IMO) it should work:

  1. I click a button
  2. A panel appears

Here's how it works now:

  1. I click a button
  2. Nothing happens
  3. I resize a window or press F11 (which is resizing too, anyway)
  4. A panel appears

So, can somebody explain why is this happening and how can I solve my issue? Thx.


回答1:


I've found a way to get around this. Here it is:

app.viewport.dockedItems.items[0].rendered = false;
app.viewport.doComponentLayout();

So, problem solved.




回答2:


I don't know exactly what your code is doing but you need to do a doLayout or doComponentLayout call on the Panel to refresh the items when adding or removing components.

The resize event which happens when changing the browser window performs that call which is probably the reason why you are seeing that behavior.




回答3:


I've posted an answer here that might be of use to fix this issue.

http://www.sencha.com/forum/showthread.php?141705-Show-Hide-Toolbar-docked-panel-briefly-renders-incorrectly&p=762261&viewfull=1#post762261



来源:https://stackoverflow.com/questions/6188754/sencha-touch-panel-hide-show-works-only-after-resize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!