[Seaside] How to serialize jQuery UI Selectable?
Lukas Renggli
renggli at gmail.com
Fri Jan 29 09:06:43 UTC 2010
Startign from the code example:
> renderContentOn: html
As a target of the list:
html div id: 'listing'; with: selected.
> html unorderedList
> script: (html jQuery new selectable
> onStop: (html jQuery ajax
> callback: [ :value | selected := value asSet ]
> passengers: (html jQuery this find: '.ui-selected'));
And then to update the above DIV whenever the selection changes:
script: [ :s | s add: ((s jQuery:
#listing) html: selected) ]);
> with: [
> self vegetables do: [ :each |
> html listItem
> class: 'ui-corner-all';
> class: 'ui-selected' if: (selected includes: each);
> passenger: each;
> with: each ] ]
As usual I have written that directly in the mail, so there might be bugs :-)
Lukas
>
>
> While there is a callback, I can't figure out how to display the selected items.
>
>
> For comparison, here is the code from Multi-Select-List, in JQFormFunctionalTest (I cleaned up the original code):
>
> renderContentOn: html
> html fieldSet: [
> html span: [
> html multiSelect
> size: 9;
> list: (1 to: 9);
> selected: multiSelectList;
> callback: [ :value | multiSelectList := value ];
> onChange: (
> " update the paragraph "
> ((html jQuery this
> parents: 'fieldset';
> find: 'p') load
> " serialize all nearby form elements "
> serialize: (html jQuery this
> parents: 'span';
> find: ':input'))
> html: [ :h | h render: multiSelectList ]) ].
> html paragraph: multiSelectList ]
>
>
> This includes instructions to serialize the elements, but I'm having a lot of problems trying to do the same thing in the Selectable example.
>
> I'd be grateful for your insight!
>
> Thanks,
>
> Amir
>
>
>
> On Thu, 28 Jan 2010 23:36:35 +0100
> Lukas Renggli <renggli at gmail.com> wrote:
>
>> This demo does not go back to the server, that's purely client side.
>>
>> Have a look at JQSelectableFunctionalTest for a demo in Seaside that
>> serializes back the selected elements to the server.
>>
>> Lukas
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
--
Lukas Renggli
http://www.lukas-renggli.ch
More information about the seaside
mailing list