Hi...
I am also kind of new to scriptaculous... (I will never learn how to
spell this )
and I had exactly the same problem: How to limit the
number of entries... And after a few hours of searching through the
source code I found the right place to change :-) Maybe a sooner look
into this forum would have been useful...
So, this is, what you have to do:
The function handling the focussing on different droplists are called
onHover and onEmptyHover. I used only the second one, but you can
probably change the other one in a similar way. The one thing, that
took me a long time is to realize, that, when you hit another
dropzone. The object is actually already move to the new place in the
DOM tree of the webpage. So if you stop the movement after that, it is
in a way too late. So you have to prevent this movement
if ((droponOptions.maxItems == null)||
(Sortable.sequence(dropon).length < droponOptions.maxItems))
{
dropon.insertBefore(element, child); // <--- this is the line
in on EmptyHover to disable!
}
This way close to line 808 or so in dragdrop.js. I added another
options: maxItems, which can easily be set in the create function of
Sortable.
Sortable.sequence(dropon).length
gives the number of items in the dropzone...
Hope this helps...
Is maybe not a perfect solution, since you can still hit the dropzone,
but not drop anything on it...
Cheers,
Jan
On 15 Feb., 11:33, cron <playh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello,
>
> Well, i need tolimitthe number of elements in asortable. I new to
> scriptaculo but i have lots of experiencie with javascript.
>
> Sincelimitthe number of elements is not supported bySortablei
> would like to implement, i already took a look at theSortableclass
> in dragdrop.js and it looks like that onHover and onEmptyHover deal
> with the update of the UI, however I''m not unable to find where
the
> *onDrop* event happens for aSortableitem.
>
> Any guidance on how to accomplish this tasks i greatly appreciate
>
> Tks,
>
> Cron
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---