Re: Ajax Sortable & Droppable together?
Re: Ajax Sortable & Droppable together?
- Subject: Re: Ajax Sortable & Droppable together?
- From: Ken Anderson <email@hidden>
- Date: Wed, 04 Sep 2013 10:53:32 -0400
Thanks Samuel - I'll try it!
On Sep 4, 2013, at 10:24 AM, Samuel Pelletier <email@hidden> wrote:
> Ken,
>
>> Samuel,
>>
>> I'm not really sure I'm being clear with what I want to do.
>>
>> I have a list of source objects in one repetition. The items are draggable. Then, I have a drop zone, but when you drop one of the draggable items it always puts it at the end.
>>
>> What I need to do is:
>>
>> 1) Determine between what items on the destination at the droppable item was dropped.
>
> My solution was to create a droppable between each items. If you have 3 items, you will have this structure if you allow drop before first and after last:
> droppable0
> item1
> droppable1
> item2
> droppable2
> item3
> droppable3
>
> On my application, all these where enclosed inside a bigger droppable that added the item at the last position to create a bigger target.
>
> You bind the value of the AjaxDraggable to the object being dragged. You bind the action of each droppable (probable to the dame action) and the droppedObject to the attribute of the controller that should represent the dropped object (droppedObject will be set with the value binding of the draggable dropped).
>
> At this point, the usual magic append, if your droppable are created inside a repetition, the WORepetition item binding will contains the expected item for the droppable. For the first (or the last) one, you will need a different action because it is outside the repetition and you will need to know it. Outside the repetition, the item will be bound to the last item of the list.
>
>> 2) Insert the item at that point in the array on the server side.
>
> At this point you have all the information required, an array index of the item representing the droppable and the object being dragged.
>
>
>> I'm really not clear how to do this. I would think I would at least need to work with javascript to know WHERE it was dropped in the droppable zone. Am I wrong?
>
> I think it is far easier to create multiple drop zone, the are javascript hooks available but just deciding on how the where should be interpreted would be challenging and creating a feedback to the user will be hard. With multiple drop zone, the feed back is easy, bind the "hoverclass" of your AjaxDroppable to the css class to use when this droppable is the current target (add some background colour or a thicker coloured borderline).
>
> Hope this will help,
>
> Samuel
>
>
>>
>> Thanks for all your assistance!
>>
>> Ken
>>
>> On Sep 3, 2013, at 2:35 PM, Samuel Pelletier <email@hidden> wrote:
>>
>>> Ken,
>>>
>>> I do not have an example but the cool thing is you do not need to know javascript to use these. Check the AjaxExample project in the wonder source.
>>>
>>> You create AjaxDroppable and AjaxDraggable (they create div html elements by default), bind them to actions and objects. On drop, the action and called with the objects bounds as expected.
>>>
>>> You will only need to dig into Prototype and Scriptaculous doc if you want to fine tune behaviour like filter acceptable drop targets.
>>>
>>> Samuel
>>>
>>> Le 2013-08-30 à 16:46, Ken Anderson <email@hidden> a écrit :
>>>
>>>> Thanks Samuel. Would you have an example? I have to say, I'm no javascript expert…
>>>>
>>>>
>>>> On Aug 30, 2013, at 2:05 PM, Samuel Pelletier <email@hidden> wrote:
>>>>
>>>>> Ken,
>>>>>
>>>>> You can create multiple droppable instance and even put droppable inside droppable for a more precise location. You can have a draggable inside a droppable too.
>>>>>
>>>>> I created a truck dispatch application with those where you can dispatch a job to a truck (the created destination added at route end), after a specific destination and reorder the truck destinations.
>>>>>
>>>>> Samuel
>>>>>
>>>>> Le 2013-08-28 à 22:43, Ken Anderson <email@hidden> a écrit :
>>>>>
>>>>>> Colleagues,
>>>>>>
>>>>>> Using the Ajax stuff in Wonder, I would like to have the ability to drag from the source repetition and drop at a specific point in the droppable region. This is pretty much having sortable and droppable in the same area. Has anyone done this? If not, does anyone have a recommended approach?
>>>>>>
>>>>>> Thanks,
>>>>>> Ken
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>
>>>>>> This email sent to email@hidden
>>>>>
>>>>
>>>
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden