Yii Framework Forum: CTreeView using url and toggle - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CTreeView using url and toggle Rate Topic: -----

#1 User is offline   Ian 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 02-October 10
  • Location:Billings, MT

Posted 01 November 2010 - 08:01 AM

Greetings,

I'm using CTreeView with 'url' and 'toggle' and both seem to work but I have a bit of a problem. It appears the 'toggle' callback happens right when a node is clicked which is before the AJAX request can finish loading the new node. So how can one tell via Javascript when a dynamic CTreeView node has finished loading?

Thanks,
Ian
Cheers,
Ian Carlson
Xantek Inc.
0

#2 User is offline   Ian 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 02-October 10
  • Location:Billings, MT

Posted 02 November 2010 - 05:54 AM

Guess I should know these things but with some digging I found a solution to my problem. When using CTreeView with 'url' for AJAX loading 'toggle' only fires when a node is clicked. I was able to determine when nodes are done loading using jQuery by register a global .ajaxComplete() listener and then using the AJAX url to determine the request. The javascript looks something like this:

$(document).ready(function()
    {
        $('body').ajaxComplete(ajaxJustFinsihed);
    });


function ajaxJustFinsihed(event, XMLHttpRequest, ajaxOptions)
{
    if(ajaxOptions.url.indexOf('ajaxFillTree')) {
        alert('Finished loading AJAX tree nodes');
    }
}



If there is a better way I would like to know. Otherwise I hope this information save someone some time.
Cheers,
Ian Carlson
Xantek Inc.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users