I have a treeview, that works with scriptaculous in order to load the nodes dynamically.
I also have in the main part of the page, a table with the list of elements.
The lists of elements can be drag-dropped on the treeview in order to move them around
(they are also draggable on other parts of the page)
I need though, to refresh the treeview to reflect changes when a folder was moved (the branches changes)
so i call the server to get a fragment of HTML (I know it could have been a fragment of XML, processed
on client side but in my use case, it's a rendered HTML piece)
This sent piece contains _javascript_ as well, in order to make the dynamic node still
working.
When the dom is reloaded, the drag/drop features reloads Droppable.drops elements.
The new treeview html fragment IS the treeview that would be displayed on the
page if the user would hit F5 after the drag.
Everything work fine, except that the droppable areas of the freshly updated treeview
are not enabled anymore. They do work on other droppable parts.
here's the code that reload the treeview:
var CPSPortletRefresher = Class.create();
CPSPortletRefresher.prototype = {
initialize: function() { }, 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); } }, refreshPortlet: function(portlet_id) { var params = 'portlet_id=' + portlet_id; url = "" style="color: rgb(221, 0, 0);">'viewPortlet'; var refreshPortletCompletedBn = this.refreshPortletCompleted.bind(this); var options = {parameters: params, onComplete: refreshPortletCompletedBn}; this.last_portlet_id = portlet_id; var sender = new Ajax.Request(url, options); }, } var portlet_refresher = new CPSPortletRefresher();
So two question:
1/ is the innerHTML reliable for this kind of job ?
2/ Do I miss something ? :)
Thanks !
Tarek
--
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