[jQuery] Re: clone() + Sortable and Draggable
Hello again ! I'm back on this project, and I tried the trick you gave me. Unfortunately, that doesn't seem to work. The newly created sortable doesn't accept elements... :-( The only 'solution' I have for now is to create a bunch of hidden sortables at the bottom of my source code, and move (append) one when I need a new one. Please let me know if you see anything else. Jérôme. On Tue, Jul 28, 2009 at 19:31, Jérôme GRAS wrote: > That's a great idea. > I tried something similar but your way seems better :) > I'm currently on a trip, I'll keep you in touch. > Jérôme. > > > On Tue, Jul 28, 2009 at 15:07, Mean Mike wrote: > >> >> I have an idea not sure if it will work or not but instead of trying >> to find a plug in to do the live() function with sortable why not just >> target the newly created list you could make a function something >> like this >> >> function make_sortable(item){ >>$(item).sortable({ >> revert: true, >> connectWith: $(".liste_champs"), >> start: function(){ >> $(".liste_champs").addClass('ui-state-highlight'); >> }, >> stop: function(){ >> $(".liste_champs").removeClass('ui-state-highlight'); >> }, >> receive: function(){ >> $("#champs").append($("#champs_caches").children().clone >> (true)); >> } >> }); >> } >> >> then anytime you add a new ul to the dom you could attach the sortable >> to it ... this is just pseudo code but I think it will do the trick. >> >> let me know what you think >> Mike >> >> On Jul 28, 1:28 am, Jérôme GRAS wrote: >> > That's seems to be exactly what I needed. >> > Unfortunately, live() only works with a limited number of events, and >> not >> > with sortable. >> > I saw there may be a plugin that could help : livequery. >> > No time to investigate further for now. >> > See you in a few weeks ! >> > :D >> > >> > On Fri, Jul 24, 2009 at 18:27, Jérôme GRAS >> wrote: >> > > No problem for the delay, thank you for your response. >> > > I may be away for a while but I'll try to test and investigate as soon >> as >> > > possible. >> > > I will keep you updated. >> > >> > > On Fri, Jul 24, 2009 at 16:16, Mean Mike wrote: >> > >> > >> its because you need to make it live so that when new items with the >> > >> same class show up they become sortable. I've never used live with >> > >> sortable so you might need to investigate further but I think this >> > >> will work >> > >> > >> $(".liste_champs")live("sortable", function(){ >> > >> revert: true, >> > >> connectWith: $(".liste_champs"), >> > >> start: function(){ >> > >> $(".liste_champs").addClass('ui-state-highlight'); >> > >> }, >> > >> stop: function(){ >> > >> $(".liste_champs").removeClass('ui-state-highlight'); >> > >> }, >> > >> receive: function(){ >> > >> $("#champs").append($("#champs_caches").children().clone >> > >> (true)); >> > >> } >> > >> }); >> > >> > >> btw sorry for the delay >> > >> > >> On Jul 17, 4:35 pm, Jérôme GRAS wrote: >> > >> > Ok, I fixed the first id bug. >> > >> > The new version is online. >> > >> > >> > Unfortunately, the main problem is still present. >> > >> > I tried a lot of things unsuccessfully... >> > >> > >> > Please take a look :-) >> > >> > >> > On Fri, Jul 17, 2009 at 15:07, Mean Mike >> wrote: >> > >> > >> > > I found a least one major problem here >> > >> > >> > > >> $("#champs").append($("#champs_caches").clone(true).removeClass("ui- >> > >> > > helper-hidden")); >> > >> > >> > > your cloning div with id "#champs_caches" thereby creating >> another >> > >> > > div with the same id >> > >> > >> > > there may be more problems than that but get that fixed then lets >> go >> > >> > > from there >> > >> > >> > > Mean Mike >> > >> > >> > > On Jul 17, 2:58 am, rejome wrote: >> > >> > > > Hello everyone ! >> > >> > >> > > > I am facing a strange problem here : >> > >> > >http://rejome.homeip.net:8080/prototype.html >> > >> > >> > > > When I clone a list that is part of a Sortable, the Draggable >> > >> objects >> > >> > > > are not bound to the cloned list, only the original one. >> > >> > >> > > > Do you have a solution or a hint for me please ? >> > >> > >> > > > Thanks in advance. >> > >> > > > Réjôme. >> >> >> >
[jQuery] Re: clone() + Sortable and Draggable
That's a great idea. I tried something similar but your way seems better :) I'm currently on a trip, I'll keep you in touch. Jérôme. On Tue, Jul 28, 2009 at 15:07, Mean Mike wrote: > > I have an idea not sure if it will work or not but instead of trying > to find a plug in to do the live() function with sortable why not just > target the newly created list you could make a function something > like this > > function make_sortable(item){ >$(item).sortable({ > revert: true, > connectWith: $(".liste_champs"), > start: function(){ > $(".liste_champs").addClass('ui-state-highlight'); > }, > stop: function(){ > $(".liste_champs").removeClass('ui-state-highlight'); > }, > receive: function(){ > $("#champs").append($("#champs_caches").children().clone > (true)); > } > }); > } > > then anytime you add a new ul to the dom you could attach the sortable > to it ... this is just pseudo code but I think it will do the trick. > > let me know what you think > Mike > > On Jul 28, 1:28 am, Jérôme GRAS wrote: > > That's seems to be exactly what I needed. > > Unfortunately, live() only works with a limited number of events, and not > > with sortable. > > I saw there may be a plugin that could help : livequery. > > No time to investigate further for now. > > See you in a few weeks ! > > :D > > > > On Fri, Jul 24, 2009 at 18:27, Jérôme GRAS wrote: > > > No problem for the delay, thank you for your response. > > > I may be away for a while but I'll try to test and investigate as soon > as > > > possible. > > > I will keep you updated. > > > > > On Fri, Jul 24, 2009 at 16:16, Mean Mike wrote: > > > > >> its because you need to make it live so that when new items with the > > >> same class show up they become sortable. I've never used live with > > >> sortable so you might need to investigate further but I think this > > >> will work > > > > >> $(".liste_champs")live("sortable", function(){ > > >> revert: true, > > >> connectWith: $(".liste_champs"), > > >> start: function(){ > > >> $(".liste_champs").addClass('ui-state-highlight'); > > >> }, > > >> stop: function(){ > > >> $(".liste_champs").removeClass('ui-state-highlight'); > > >> }, > > >> receive: function(){ > > >> $("#champs").append($("#champs_caches").children().clone > > >> (true)); > > >> } > > >> }); > > > > >> btw sorry for the delay > > > > >> On Jul 17, 4:35 pm, Jérôme GRAS wrote: > > >> > Ok, I fixed the first id bug. > > >> > The new version is online. > > > > >> > Unfortunately, the main problem is still present. > > >> > I tried a lot of things unsuccessfully... > > > > >> > Please take a look :-) > > > > >> > On Fri, Jul 17, 2009 at 15:07, Mean Mike > wrote: > > > > >> > > I found a least one major problem here > > > > >> > > > $("#champs").append($("#champs_caches").clone(true).removeClass("ui- > > >> > > helper-hidden")); > > > > >> > > your cloning div with id "#champs_caches" thereby creating > another > > >> > > div with the same id > > > > >> > > there may be more problems than that but get that fixed then lets > go > > >> > > from there > > > > >> > > Mean Mike > > > > >> > > On Jul 17, 2:58 am, rejome wrote: > > >> > > > Hello everyone ! > > > > >> > > > I am facing a strange problem here : > > >> > >http://rejome.homeip.net:8080/prototype.html > > > > >> > > > When I clone a list that is part of a Sortable, the Draggable > > >> objects > > >> > > > are not bound to the cloned list, only the original one. > > > > >> > > > Do you have a solution or a hint for me please ? > > > > >> > > > Thanks in advance. > > >> > > > Réjôme. > > >
[jQuery] Re: clone() + Sortable and Draggable
That's seems to be exactly what I needed. Unfortunately, live() only works with a limited number of events, and not with sortable. I saw there may be a plugin that could help : livequery. No time to investigate further for now. See you in a few weeks ! :D On Fri, Jul 24, 2009 at 18:27, Jérôme GRAS wrote: > No problem for the delay, thank you for your response. > I may be away for a while but I'll try to test and investigate as soon as > possible. > I will keep you updated. > > > On Fri, Jul 24, 2009 at 16:16, Mean Mike wrote: > >> >> its because you need to make it live so that when new items with the >> same class show up they become sortable. I've never used live with >> sortable so you might need to investigate further but I think this >> will work >> >> $(".liste_champs")live("sortable", function(){ >> revert: true, >> connectWith: $(".liste_champs"), >> start: function(){ >> $(".liste_champs").addClass('ui-state-highlight'); >> }, >> stop: function(){ >> $(".liste_champs").removeClass('ui-state-highlight'); >> }, >> receive: function(){ >> $("#champs").append($("#champs_caches").children().clone >> (true)); >> } >> }); >> >> >> btw sorry for the delay >> >> On Jul 17, 4:35 pm, Jérôme GRAS wrote: >> > Ok, I fixed the first id bug. >> > The new version is online. >> > >> > Unfortunately, the main problem is still present. >> > I tried a lot of things unsuccessfully... >> > >> > Please take a look :-) >> > >> > On Fri, Jul 17, 2009 at 15:07, Mean Mike wrote: >> > >> > > I found a least one major problem here >> > >> > > $("#champs").append($("#champs_caches").clone(true).removeClass("ui- >> > > helper-hidden")); >> > >> > > your cloning div with id "#champs_caches" thereby creating another >> > > div with the same id >> > >> > > there may be more problems than that but get that fixed then lets go >> > > from there >> > >> > > Mean Mike >> > >> > > On Jul 17, 2:58 am, rejome wrote: >> > > > Hello everyone ! >> > >> > > > I am facing a strange problem here : >> > >http://rejome.homeip.net:8080/prototype.html >> > >> > > > When I clone a list that is part of a Sortable, the Draggable >> objects >> > > > are not bound to the cloned list, only the original one. >> > >> > > > Do you have a solution or a hint for me please ? >> > >> > > > Thanks in advance. >> > > > Réjôme. >> >> >> >
[jQuery] Re: clone() + Sortable and Draggable
No problem for the delay, thank you for your response. I may be away for a while but I'll try to test and investigate as soon as possible. I will keep you updated. On Fri, Jul 24, 2009 at 16:16, Mean Mike wrote: > > its because you need to make it live so that when new items with the > same class show up they become sortable. I've never used live with > sortable so you might need to investigate further but I think this > will work > > $(".liste_champs")live("sortable", function(){ > revert: true, > connectWith: $(".liste_champs"), > start: function(){ > $(".liste_champs").addClass('ui-state-highlight'); > }, > stop: function(){ > $(".liste_champs").removeClass('ui-state-highlight'); > }, > receive: function(){ > $("#champs").append($("#champs_caches").children().clone > (true)); > } > }); > > > btw sorry for the delay > > On Jul 17, 4:35 pm, Jérôme GRAS wrote: > > Ok, I fixed the first id bug. > > The new version is online. > > > > Unfortunately, the main problem is still present. > > I tried a lot of things unsuccessfully... > > > > Please take a look :-) > > > > On Fri, Jul 17, 2009 at 15:07, Mean Mike wrote: > > > > > I found a least one major problem here > > > > > $("#champs").append($("#champs_caches").clone(true).removeClass("ui- > > > helper-hidden")); > > > > > your cloning div with id "#champs_caches" thereby creating another > > > div with the same id > > > > > there may be more problems than that but get that fixed then lets go > > > from there > > > > > Mean Mike > > > > > On Jul 17, 2:58 am, rejome wrote: > > > > Hello everyone ! > > > > > > I am facing a strange problem here : > > >http://rejome.homeip.net:8080/prototype.html > > > > > > When I clone a list that is part of a Sortable, the Draggable objects > > > > are not bound to the cloned list, only the original one. > > > > > > Do you have a solution or a hint for me please ? > > > > > > Thanks in advance. > > > > Réjôme. > > >
[jQuery] Re: clone() + Sortable and Draggable
Ok, I fixed the first id bug. The new version is online. Unfortunately, the main problem is still present. I tried a lot of things unsuccessfully... Please take a look :-) On Fri, Jul 17, 2009 at 15:07, Mean Mike wrote: > > I found a least one major problem here > > $("#champs").append($("#champs_caches").clone(true).removeClass("ui- > helper-hidden")); > > your cloning div with id "#champs_caches" thereby creating another > div with the same id > > there may be more problems than that but get that fixed then lets go > from there > > Mean Mike > > On Jul 17, 2:58 am, rejome wrote: > > Hello everyone ! > > > > I am facing a strange problem here : > http://rejome.homeip.net:8080/prototype.html > > > > When I clone a list that is part of a Sortable, the Draggable objects > > are not bound to the cloned list, only the original one. > > > > Do you have a solution or a hint for me please ? > > > > Thanks in advance. > > Réjôme. > > >