I'm using the async version of the treeview plugin, which refreshes
the tree with an ajax call that returns some json.  This is working
fine.  However, the cookie-based persistence doesn't work with the
async version and i'm trying to write my own.  In order to do this,
i'm using jQuery to monitor when the user clicks on li items in the
tree, so i can pull out the ids of the expanded items to save in the
cookie.  For now, though, i'm just testing it with alerts:

jQuery("#prop-tree li").click( function(){
        alert( jQuery(this).attr('id') );
      });

If i run this in the firebug console, it works fine - even for newly
loaded li's which weren't there at the time it was run (ie, if i run
the code in the console and open a branch, i get an alert for that
branch, and i also get alerts if i click on the new branch).

However, if i put the code in the "jQuery(document).ready(function()
{ " block, then it doesn't work: i suspect this is because the json
hasn't come back yet and therefore there's nothing for the jQuery to
find: at the time it runs, the property tree just looks like this:

  <ul id='prop-tree'>

  </ul>

Does anyone know of a way i can run my listener code AFTER some JSON
comes back and populates the tree?  I think it only needs to happen
after the initial bunch comes back, not every time.

Reply via email to