-
22 Feb 2007 4:14 AM #1
Tree Menu no longer working 1.0a
Tree Menu no longer working 1.0a
I like the simplicity of the menu bar that is in the documentation, so I was using it for a project. However it worked fine in 0.4 but its not working in 1.0a
and here is the error:Code:setupTree : function(){ var classes = Ext.get('classes'); classes.on('click', classClicked ); classes.select('h3').each(function(el){ var c = new NavNode(el); if(!/^(?:Assets|Portfolios|Settings)$/.test(el.innerHTML)){ c.collapse(); } }); $('classes').style.display = ""; }, var NavNode = function(clickEl, collapseEl){ this.clickEl = Ext.get(clickEl); if(!collapseEl){ collapseEl = this.clickEl.dom.nextSibling; while(collapseEl.nodeType != 1){ collapseEl = collapseEl.nextSibling; } } this.collapseEl = Ext.get(collapseEl); this.clickEl.addClass('collapser-expanded'); this.clickEl.on('click', function(){ this.collapsed === true ? this.expand() : this.collapse(); }, this); }; NavNode.prototype = { collapse : function(){ this.collapsed = true; this.collapseEl.setDisplayed(false); this.clickEl.replaceClass('collapser-expanded','collapser-collapsed'); }, expand : function(){ this.collapseEl.setDisplayed(true); this.collapsed = false; this.collapseEl.setStyle('height', ''); this.clickEl.replaceClass('collapser-collapsed','collapser-expanded'); } };
Looking at in Firebug, 'collapeEl' is null. Did I miss anything in the "port" from 0.4 to 1.0?Code:collapseEl has no properties NavNode(Object dom=body#yui-gen0.ext-gecko id=yui-gen0, null)secure (line 295) (no name)(Object dom=body#yui-gen0.ext-gecko id=yui-gen0)secure (line 182) CompositeElement(function(), undefined)ext-all.js (line 22) setupTree()secure (line 181) Element()ext-all.js (line 20) CustomEvent()event-min.js (line 1) CustomEvent()event-min.js (line 1) [Break on this error] while(collapseEl.nodeType != 1){
thank you
-
22 Feb 2007 6:33 AM #2
You will need to grab the "dom" property. I had to make this change in the docs as well. each() on the composite element now passes the flyweight Element (not the raw dom node).
-
22 Feb 2007 8:38 AM #3
Great thanks Jack -- and how does one do that exactly!
Originally Posted by jacksloc

Is there a preliminary 1.0a docs anywhere, or should i be using the 0.40 as reference?
-
22 Feb 2007 8:47 AM #4
He just meant that you have to use the dom property of the el passed to the function
Code:// els is your array of elements els.each(function(el) { el.setStyle('borderColor', 'blue'); // native Element fns el.dom.innerHTML = 'foo'; // or talk directly to dom if needed. });Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
22 Feb 2007 9:12 AM #5
Fantastic ... another happy bunny. Thank you.
For completeness of the thread, here is the changed method, works a treat
Code:classes.select('h3').each(function(el){ var c = new NavNode(el.dom); if(!/^(?:Assets|Portfolios|Settings)$/.test(el.dom.innerHTML)){ c.collapse(); } });
Similar Threads
-
Tree dragdrop not working using IE
By liotrox in forum Ext 1.x: Help & DiscussionReplies: 3Last Post: 8 Jan 2007, 11:26 AM -
Tree 'selectionchange' event is not working
By liotrox in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 5 Jan 2007, 9:20 AM -
Example of Tree Menu ?
By peter_n in forum Ext 1.x: Help & DiscussionReplies: 5Last Post: 5 Jan 2007, 8:09 AM -
Menu Tree
By jfaust97 in forum Ext 1.x: Help & DiscussionReplies: 6Last Post: 20 Dec 2006, 5:01 AM -
MENU TREE....
By genius551v in forum Ext 1.x: Help & DiscussionReplies: 3Last Post: 10 Oct 2006, 9:54 PM


Reply With Quote