-
25 Feb 2013 4:14 AM #1
Max Height for autoSizing of Component
Max Height for autoSizing of Component
Hi guys,
i've created my own treecombo which extends TriggerField with autosizing for this component. I would like to create some criteria for autosizing like when height > 300 then use hardcoded height 300 and show vertical scrollbar. Is it somehow possible ? Reason for that is the fact that if i expand many nodes in tree then combo size becames bigger than actual page size is and user is unable to see many of nodes ..
initializaton of combo looks like:
rest of code is not important i guess and i'm using sentcha 3.4Code:initList: function() { var root = new Ext.tree.AsyncTreeNode({ text: this.rootText }); this.list = new Ext.tree.TreePanel({ rootVisible: true, cls: this.treeCls, autoScroll: true, containerScroll: true, loader: new Ext.tree.TreeLoader(), floating: true, autoSize: true, listeners: { click: this.onNodeClick, scope: this }, alignTo: function(el, pos) { this.setPagePosition(this.el.getAlignToXY(el, pos)); } }); this.list.setRootNode(root); },
Thx for any help
Pavol
-
25 Feb 2013 6:52 AM #2
AutoSizing components usually also have a maxHeight config for this purpose (e.g. textarea).
However, if you place the treePanel inside another panel with a 'fit' layout, then you should automatically get a scrollbar once the treepanel exceeds the height of the containing panel anyway...
-
26 Feb 2013 1:22 AM #3
Thx willigogs for answer, but problem is that if i set parent panel with some fixed height or fit layout and number of nodes is low number i will see white space which i want to avoid .. therefor it will be better to have autoresizing till height < 300 and if height exceed 300 then set fixed height to see scrollbar

Check picture for example:
pic1.png
-
26 Feb 2013 3:06 AM #4
In that case, simply add a CSS max-height attribute to the treepanel

Be aware this won't work for IE6 and below though, since it doesn't support the max-height CSS rule.Code:this.list = new Ext.tree.TreePanel({ ...CONFIGS HERE... style: { maxHeight:'300px', overflow:'auto' } })
-
26 Feb 2013 4:10 AM #5
yep man
it works .. i was trying maxHeight attribute before but i forgot to set overflow to auto 
You've made my day .. thx a lot !!!
-
26 Feb 2013 5:04 AM #6
Maybe one more thing which you can help me with ..
I'm styling this component now and want to have border (black ones) around list component which is solved by adding class by
But problem is that i have still some border(blue ones) around data in list component pointing to:Code:this.list = new Ext.tree.TreePanel({ rootVisible: true, cls: 'someClass' });
<div id="ext-gen313" class="x-panel-body x-panel-body-noheader">
and i would like to set these borders to none but i dont know which bloody component render that ..
Check picture:
pic3.png
-
26 Feb 2013 8:20 AM #7
Try adding border: false to your treepanel config

-
28 Feb 2013 12:02 AM #8
-
4 Mar 2013 1:37 AM #9
-
14 Mar 2013 5:42 AM #10
It will be good to know where this autosizing is done at least .. I checked all the component to last child
TreePanel<--Panel<--Container<--ext.BoxComponent<--Component and was unable to find function which handle that ..


Reply With Quote
