Hi!

That is dirty but works :)

        $("#sortable").sortable({
            handle: '.handle',
            placeholder : 'sortableHelper',
            forcePlaceholderSize: 'true',
            receive : function (e, ui) {
                if($("#sortable li").length > 10){
                    ui.item.remove();
                }
            }
        });

El 16/11/2008, a las 9:31, CodeOfficer escribió:

>
> I'm struggling with the best way to approach this one, could one of
> you jQuery UI gurus suggest a solution?
>
> I have 2 lists ... the user is expected to drag items from list 1 and
> drop them onto list 2. List 2 then behaves as a sortable, so after
> these items from list 1 are dropped, they can be sorted within list
> 2.
>
> I have that much working already!
>
> My issue is ... List 2 should ONLY allow a maximum of 10 items to be
> dropped in it.
>
> What is the best way to disable the dropping of items from list 1 onto
> list 2 for this situation? I cant find any hooks for sortable() or
> draggable() that allow me to disable a drop conditionally. There must
> be a proper way to do this.
>
> This is the code I am using now ... and its functional otherwise ...
>
> $("#draggable > li").draggable({
>       helper: 'clone',
>       connectToSortable: '#sortable',
>       cursor: 'move',
>       distance: 20,
>       opacity: .5,
>       revert: 'invalid'
> });
>
> $("#sortable").sortable({
>       handle: '.handle',
>       placeholder : 'sortableHelper',
>       forcePlaceholderSize: 'true',
>       receive : function (e, ui) {
>               console.log($('#sortable').sortable('serialize'));
>    }
> });
>
> ul id=draggable
>    li ...
> /ul
>
> ul id=sortable
>    li ...
> /ul
>
>
>
>
>
> >

mamuso
http://mamuso.net
http://smupf.com




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to