Hi all,

First - thanks for the great plug-in and saving me tons of work!

I'm using Treeview 1.4 and jQuery 1.2.6 and everything is working well
except for a strange problem when adding a new Menu Item. It appears
to add the item properly but the toggle stops working every other time
I click the "add" button starting with the first time. So the first
item adds but the whole tree stops wroking. Then I add the second new
item and everything works again - and so on.

Here is my add button code:

$("#addMenuItem").click(function() {
        var tree = $("#menuList").treeview();
        var itemCount= $("#menuList>li").size()+1;
        var newMenuItem =  $('<li id="Menu_'+itemCount+'" ><span
class="folder"><a href="#">New Menu Item</a></span>'+
        '<input type="hidden" id="Title_'+itemCount+'" name="Title_'+itemCount
+'" value="">'+
        '<input type="hidden" id="MenuAction_'+itemCount+'"
name="MenuAction_'+itemCount+'" value="">'+
        '<input type="hidden" id="OpenNew_'+itemCount+'"
name="OpenNew_'+itemCount+'" value="">'+
        '<input type="hidden" id="FullPageChecked_'+itemCount+'"
name="FullPageChecked_'+itemCount+'" value="">'+
        '<ul id="SubMenu_'+itemCount+'"><li id="addSubMenuItem_MI-'+itemCount
+'_SM-0><a href="#">Add SubmenuItem</a></li></ul></li>')
                 .appendTo(tree);
                 tree.treeview({add: newMenuItem});
        })

Any help would be appreciated.

Reply via email to