[Seaside] JQDroppable convience method

Lukas Renggli renggli at gmail.com
Wed Oct 28 12:03:37 UTC 2009


I've quickly added some convenience methods to JQAjax that serialize
the information of the jQueryUI events:

     #callbackAccordion:
     #callbackDraggable:
     #callbackDroppable:
     #callbackResizable:
     #callbackSlider:
     #callbackSortable:
     #callbackTabs:

All these callbacks expect a block with one argument that gets
evaluated with a dictionary of the event elements as documented in the
jQueryUI documentation.

Johan, your code would now look like this:

    ... onDrop: (html ajax
        callbackDroppable: [ :event |
            (event at: #draggable) doSomething ])

Note that I also renamed #trigger:passengers: to
#callback:passengers:, that fits better the jQuery protocol.

Let me know if this is useful or if there is something else missing.
This is mostly untested functionality so expect to encounter bugs.

Cheers,
Lukas






2009/10/28 Lukas Renggli <renggli at gmail.com>:
>> That's right but $(this) is bound to the droppable, while it's often
>> convenient to get the object that was dragged onto it (the draggable).
>> Using the trigger:passengers: approach, it seems impossible to me to get to
>> the draggable.
>>
>> Or am I missing something?
>
> No, this is jQuery that is missing something ;-)
>
> Currently there is almost no support to get the parameters from events
> back into the image. I will add some helper methods to JQAjax to make
> this simpler. I am not particularly fond of adding something like
> #onDropCallback: because this hardcodes an AJAX request and does not
> give the user the possibility to define additional AJAX actions,
> render something, change something, etc.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
>



-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list