Hi all,

As I already read it somewhere the documentation, in order to use
sortable inside sortable, they must be invoke in a specific order.
But I have found a (kludge) solution to bypass this difficulty and I
wish it could be provided natively in scriptaculous...

Let's imagine the following situation :
 * We have a portal, in which portlets are being made sortable
 * We have some portlets that want to provide drag&drop features.

Example :
 * a portal with 2 portlets
 * one portlet provides a sortable list of items

---------------
<div id="portal">

 <div id="porlet_1">
  <ul id="items">
   <li id="item_1">Foo</li>
   <li id="item_2">Bar</li>
  </ul>
  <script>
   new Sortable('items', ...);
  </script>
 </div>

 <div id="porlet_2">
  ...
 </div>

 <script>
   new Sortable('portal', ...);
 </script>

</div>
---------------------

In a static world this would be easy as you could know what is in your
portal and invoke sortable create in the proper order, but some
requirements are making this impossible...

Requirements (as seen from the portal maker) :
 * portlets can be provided by third parties (the portal is provided
by the CMS)
 * portlet may be loaded on first request, or later using ajax
=> the invokation of 'Sortable.create()' is the responsability of each
developper, and invokation order for portal/portlet may differ and
cannot be guaranteed.

Need :
 * being able to invoke Sortable.create in whatever order

Temporary solution :
  * create new js file 'portalsortable.js'
  * copypaste 'SortableObserver' and 'Sortable' from 'dragdrop.js' to
'portalsortable.js'
  * replace all occurence of SortableObserver with
PortalSortableObserver
  * replace all occurence of Sortable with PortalSortable
  * Finally, use the new PortableSortable for the portal

It works in every cases I have tested.

My questions :
Why is there this restriction on the 'Sortable' class ?
Could you change the implementation of 'Sortable' to accommodate
whatever initialization order ?

Thanks for your help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to