[Seaside] Re: JQueryUI sortable and get smalltalk callback upon change

Mariano Martinez Peck marianopeck at gmail.com
Mon Nov 24 15:13:44 UTC 2014


On Mon, Nov 24, 2014 at 11:01 AM, Mariano Martinez Peck <
marianopeck at gmail.com> wrote:

> Hi guys,
>
> I am trying to use JQueryUI sortable for making the rows of a table
> sortable. I could make it to work at the client side but I don't now how to
> be able to get the values at the server side in order to update my internal
> OrderedCollection.
>
> I found #callbackSortable:  but it seems I am doing something wrong...
> This is what I am doing:
>
> html script: ((html jQuery: 'tbody') sortable
> onUpdate:  (html jQuery ajax
>    callbackSortable: [ :event |
>            event inspect.
> ]))
>
>
> But the event inspected has nothing.. Everything from "passanger" is nil.
> I guess I may be missing passing passengers..but I don't know what nor
> where.
>
>
I have also found I could do something like this:

('#sortable').sortable({
    start: function(e, ui) {
        // creates a temporary attribute on the element with the old index
        $(this).attr('data-previndex', ui.item.index());
    },
    update: function(e, ui) {
        // gets the new and old index then removes the temporary attribute
        var newIndex = ui.item.index();
        var oldIndex = $(this).attr('data-previndex');
        $(this).removeAttr('data-previndex');
    }});


but still..I don't how to build a callback or something so that to receive
that new and old index at the server side.

Any help is appreciated.



> Any idea?
>
> Thanks,
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20141124/540089a9/attachment.htm


More information about the seaside mailing list