Results 1 to 4 of 4

Thread: Exttracting headings from html that came from a url

  1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    11
    Vote Rating
    0
      0  

    Default 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?

    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
     }
    When I run this this snippet along with the rest of my code, h1list.getCount seems to be unhappy.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,615
    Vote Rating
    54
      0  

    Default

    Have you debugged?

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    119
      0  

    Default

    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);
          ...
        }
      }
    }

  4. #4
    Ext User
    Join Date
    Jul 2008
    Posts
    11
    Vote Rating
    0
      0  

    Default Thanks, that worked!

    The render callback was firing too early. Having a callback for the autoLoad did it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •