[jQuery] [treeview] No event on node after add node.

2009-05-19 Thread mrkeyser

Hello,

I'm french, sorry for my English, thank you google translation! ;)

I'd like to make ajax calls to load sub-nodes in my treeview.
I have the following tree:

Tree HTML :


  Item 1
  Item 2
  Item 3


Method JS :

$("span[id]").click(function() {
  var toto = $(this).parent();
  if (toto.find(">ul").length == 0) {
var id = $(this).attr("id").substring("item-".length);
$.post("/Export/GetChildItem", { "id": id }, function(data) {
  var branches = $(data).appendTo("#" + id);
  $("#tree").treeview({
add: branches
  });
});
  }

});

Result :


  Item 1
  Item 2

  Item 2-1
  Item 2-2

  
  Item 3


When I click on "item 2", no problem. If I click on "item 2-1", no
event, why?
I've tried everything, I do not see...

Thanks


[jQuery] [treeview] No event on node after add node.

2009-05-19 Thread mrkeyser

Hello,

I'm french, sorry for my English, thank you google translation! ;)

I'd like to make ajax calls to load sub-nodes in my treeview.
I have the following tree:

Tree HTML :


  Item 1
  Item 2
  Item 3


Method JS :

$("span[id]").click(function() {
  var toto = $(this).parent();
  if (toto.find(">ul").length == 0) {
var id = $(this).attr("id").substring("item-".length);
$.post("/Export/GetChildItem", { "id": id }, function(data) {
  var branches = $(data).appendTo("#" + id);
  $("#tree").treeview({
add: branches
  });
});
  }
});

Result :


  Item 1
  Item 2

  Item 2-1
  Item 2-2

  
  Item 3


When I click on "item 2", no problem. If I click on "item 2-1", no
event, why?
I've tried everything, I do not see...

Thanks