-
31 Jul 2008 11:48 PM #1
Exttracting headings from html that came from a url
Exttracting headings from html that came from a url
I have a 2 column layout where the right column is a 2-level tab panel. When I click on a second level tab, html from a url gets loaded into that panel. What I want to do is in the 'render' event callback for that panel, I want to be able to extract all the heading1 headings from the loaded html and show that as an index in the left column. What I have tried so far is to given below, but it isn't working. Any ideas on what I should be doing here?
When I run this this snippet along with the rest of my code, h1list.getCount seems to be unhappy.Code:function panelRenderHandler(p) { var h1list = p.getEl().select('h1', true); var i = h1list.getCount(); //if I know the count, maybe I can proceed further and add some code here //to build the table of contents }
-
1 Aug 2008 12:07 AM #2
Have you debugged?
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
1 Aug 2008 12:15 AM #3Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Are you using autoLoad to load the content into the panel? In that case you need to use the autoLoad callback instead of the render event (fired to soon):
Code:autoLoad: { url: '...', callback: function(el, success) { if (success) { var h1list = el.select('h1', true); ... } } }
-
1 Aug 2008 6:19 AM #4
Thanks, that worked!
Thanks, that worked!
The render callback was firing too early. Having a callback for the autoLoad did it.


Reply With Quote