cbueno/jquery-tree

This is not really an issue, but a question

GoogleCodeExporter opened this issue · 0 comments

I like your plugin. It works really well.

Can you please tell me what I need to do if I load portions of the tree 
using Ajax. Basically, I only load 1 level of the tree initially. then, 
when the "+" is clicked, I use jquery.load to insert the next level, but 
when I do that I don't see checkboxes or + signs. Can you please tell me 
what I need to do to get this to work?

Here is a snippet of code I use for dynamic loading of next level.
...
$('.' + CLASS_JQUERY_TREE_HANDLE, this).bind('click', function(){

    /* start my code */
    if ($(this).parent('li').hasClass(CLASS_JQUERY_TREE_COLLAPSED)) {
        var liId =  $(this).parent().attr("id");
        var nextLevel = document.getElementById("ul-" + liId);
        var nextLevelId = "#ul-" + liId;

$(nextLevelId).load('include/regionsCheckboxTreeForAjaxPopupSingleLevel.htm
l?regionTreeSection=regionsTree' + liId);
    }
    /* end my code */


    var leafContainer = $(this).parent('li');
    var leafHandle = leafContainer.find('>.' + 
CLASS_JQUERY_TREE_HANDLE);

    leafContainer.toggleClass(CLASS_JQUERY_TREE_COLLAPSED);
    if (leafContainer.hasClass(CLASS_JQUERY_TREE_COLLAPSED))
        leafHandle.html(TREE_NODE_HANDLE_COLLAPSED);
    else
        leafHandle.html(TREE_NODE_HANDLE_EXPANDED);
});

If this feature is not supported, I would consider paying you to implement 
Ajax based loading of tree one level at a time.

thanks,
Igor.

Original issue reported on code.google.com by igor.roy...@gtempaccount.com on 12 Mar 2010 at 5:02