View Full Version : Use ZIndexManager on non-floating component?

13 Apr 2012, 1:56 PM
Hi there,

I want to have a non-floating component supply a z-index manager to descendant components, but I don't want the component to be floating: true. This is because this component is rendered into the normal page flow, but at a certain topScroll, I move this component to fixed positioning so that it stays with the user as they scroll. In this component I'm rendering ComboBoxes, and they are not getting their z-indexes set properly since this component isn't floating.

Is there any suggested ways to handle this situation, or any good workarounds?

Looking through the source code, Ext is always checking "this.up('[floating]')", so it would seem I need to set floating=true on my component. However, I need its dom rendered into the page flow upon creation.

Any thoughts or suggestions are greatly appreciated.

16 Apr 2012, 8:21 AM
If you set floating it will make that component float which you said isn't what you want. Kind of sounds like you do when it gets the fixed positioning. ZIndexManager won't work on non-floating components, you will need to handle it yourself.

16 Apr 2012, 8:30 AM
That makes sense, although I think a little abstraction could be added to allow for this kind of pluggability.

If instead of components asking "Who above me is floating?", they asked, "Who above me knows how to give me my z-index?", which is what they really want, then this would be a non-issue. I could create a component that is marked as a "z-index provider" or something, and descendants would know to come to me for their z-index manager.

Does Sencha accept suggestions from the community in this regard? Is there a patch submission process or anything, where I could write the code and send it your way for review?


2 May 2014, 1:18 PM
I would like to have a feature like this as well.

I am customizing Sencha's desktop example to my needs and want to make the toolbar stay on top of the windows in the desktop. I can achieve this by increasing toolbar's z-index, but the problem is with context menus. Their (as well as windows) z-index is managed by the built in ZindexManager. I want to change that to have menu's z-index managed by my own ZindexManager and use toolbar's z-index as base, while windows should continue to use the built in ZindexManager. This will allow me to have the toolbar on top of the windows, yet context menus on top of the toolbar.

Now, I could tell the context menus to use a different ZindexManager (via zIndexParent (file:///C:/Development/projects/extjs-docs-4.2.0/index.html#!/api/Ext.Component-property-zIndexParent) property) if toolbar was floating. The toolbar however is not floating. It is docked to the bottom of the desktop.

2 May 2014, 1:36 PM
It almost sounds like I should create a hidden floating container, match its z-index to that of the toolbar, and then assign it as zIndexParent to the context menu...