[jQuery] Re: No event on node after add node.

2009-05-20 Thread mrkeyser

Yes!! it's ok, thank you very much.


On 20 mai, 12:26, sebastien creme  wrote:
> Does the item2-1 loaded via ajax ?
>
> if true you might use .live() to let jquery add event handler after
> all dom node loaded asynchronously.
> in your example it could give something like :
>
> $("span[id]").live('click', function() {  ..
>
> On May 19, 9:15 pm, mrkeyser  wrote:
>
> > "maybe" = "peut-être" en français. ;)
>
> > No, the problem is that no event is raised.
>
> > $("span[id]").click(function() {
> >    alert("Toto");
>
> > });
>
> > If I add an "alert (" toto "), it appears when I click on" item 2 "but
> > not when I click on" Item 2-1 ".
>
> > On 19 mai, 16:15, "#micah"  wrote:
>
> > > Is the extra '-' in span id="item-2-1" the issue? Should it be span
> > > id="item 2-1"?
>
> > > How do you say maybe in french? :)
>
> > > On May 19, 9:00 am, mrkeyser  wrote:
>
> > > > 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] Re: No event on node after add node.

2009-05-19 Thread mrkeyser

"maybe" = "peut-être" en français. ;)

No, the problem is that no event is raised.

$("span[id]").click(function() {
   alert("Toto");
});

If I add an "alert (" toto "), it appears when I click on" item 2 "but
not when I click on" Item 2-1 ".

On 19 mai, 16:15, "#micah"  wrote:
> Is the extra '-' in span id="item-2-1" the issue? Should it be span
> id="item 2-1"?
>
> How do you say maybe in french? :)
>
> On May 19, 9:00 am, mrkeyser  wrote:
>
> > 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


[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