On 2/23/06, Todd Ross <[EMAIL PROTECTED]> wrote:
yes that's what i am doind indeed,
i should've been clearer:
after the fragment is reloaded, i relaunch the initialisation of drag/drop stuff
this is part of my problem: if i do a direct innerHTML
of the code, the _javascript_ that's inside of this fragment is not "effective"
creating a new node solves this issue.
oups right thx
On 2/23/06, Tarek Ziadé <[EMAIL PROTECTED]> wrote:
> When the dom is reloaded, the drag/drop features reloads Droppable.drops
> elements.
I think this statement is the heart of your problem. There's nothing
active about scriptaculous (where you're getting the
Draggables/Droppables from) that would check for a DOM "reload" (I'm
not sure what that is? any change, perhaps?); I'm not even sure that
kind of information is available to _javascript_.
I don't know much about scriptaculous, so don't take this as the final
answer, but the magic that makes Draggables/Droppables work are the
events that are attached to each element that you make
Draggable/Droppable. When you use .innerHTML on those elements'
parent, you're effectively destroying the existing elements (and their
event associations) and creating what might look like identical
elements, but they're not; they don't have the events unless you
programatically re-initialize the Draggables/Droppables.
yes that's what i am doind indeed,
i should've been clearer:
after the fragment is reloaded, i relaunch the initialisation of drag/drop stuff
> refreshPortletCompleted: function(originalRequest) {
> // getting new positions from the server
> result = originalRequest.responseText;
>
> if (result!='') {
> $(this.last_portlet_id).innerHTML = result;
> var newdiv = document.createElement("div");
> newdiv.innerHTML = result;
> newdiv.id = this.last_portlet_id;
> olddiv = $(this.last_portlet_id);
> parent = olddiv.parentNode;
> olddiv.parentNode.replaceChild(newdiv, olddiv);
> }
> },
Isn't most of this code redundant? You only need to use innerHTML on
the existing div, or create a new div and replace the old one. Either
one achieves the same DOM structure in the end.
this is part of my problem: if i do a direct innerHTML
creating a new node solves this issue.
You also never use
'parent' anywhere.
oups right thx
Todd
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
--
Tarek Ziadé | Association AfPy | www.afpy.org
Site personnel | http://programmation-python.org
_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs