I actually just solved this, not with some animation but with some
text:  i modified the jquery.treeview.async.js file to send a custom
event after the "$.getJSON" block (line 44):

jQuery(document).trigger('treeviewLoaded');

Then in my javascript code that calls the tree i add the text to the
tree ul and then hide it when the above event occurs:

     //add some loading text:
     jQuery("#prop-tree").append("<p id='loading-text'>loading...</
p>");

     //set up call for the property tree, to get new branches as json
when tree is expanded
      jQuery("#prop-tree").treeview({
        url: "/tree/children?for=<%= tree_name %>&random=<%=
rand(100000)%><%= extra_params.collect{|k,v| '&' + k.to_s + '=' +
v.to_s}.join('')%>"
      });

      //hide the loading text once the tree has loaded
      jQuery(document).bind('treeviewLoaded', function() {
        jQuery("#loading-text").hide();
      });

It's not ideal as it's called every time a branch loads whereas it
really only needs to be called the first time.  And it feels a bit
dirty.  I'd still like to know how the animation works. :)

thanks
max

On Jun 11, 10:29 am, "Max Williams (Brighton)"
<[EMAIL PROTECTED]> wrote:
> Hi rolf
>
> yeah, that would do fine actually - i missed that.  Do you know how
> that is generated?
>
> thanks
> max
>
> On Jun 10, 5:41 pm, rolfsf <[EMAIL PROTECTED]> wrote:
>
> > If you look at the async 
> > demo:http://dev.jquery.com/view/trunk/plugins/treeview/demo/async.html
>
> > in the first tree, click on item 3, and then on item 3.6 - you'll see
> > a loading icon for a few seconds, then the branch will load. Is that
> > what you're looking for?
>
> > rolf
>
> > On Jun 10, 9:10 am, "Max Williams (Brighton)"
>
> > <[EMAIL PROTECTED]> wrote:
> > > I'm using the async version of the treeview plugin to deal with a
> > > rather large tree.  When the user first loads it there's nothing
> > > there, and quite a delay before the main set of branches loads, and
> > > i'd like to have some 'loading...' text there.
>
> > > How can i get the treeview to signal when it's finished loading the
> > > json, so i can remove the text?  Is there a simpler way to have some
> > > "loading..." text displayed so that it will disappear when the tree
> > > loads?
>
> > > thanks
> > > max

Reply via email to