[Seaside] JQSortable with LI that I do not render myself
johan at inceptive.be
Sat Jan 17 09:26:48 UTC 2015
My first question is why are you using the bootstrap select to render a list of items? If it’s not a select that you want but a sortable list, why not generate it immediately?
The bootstrap plugin is generating the html based on the html you generated in Seaside.
In this client-side conversion step, the ids and scripts generated from Seaside are not (or cannot be) copied.
You need options in the plugin to pass callbacks. I took a quick look but I don’t see any.
If there are such options (there exist other such plugins), it still is a lot of fiddling on the client-side to hook up the right js callbacks to server-side callbacks, especially if you have more than one select to handle.
But there’s probably a good reason you are trying to do this. If that’s the case, I would try to use event delegation and put event handlers on the parent element of the select.
The plugin is probably generating the li right next to existing select but with the same parent. If that is the case, you can put jQuery event handlers on that parent element (which you generate from Seaside.
script: (html jQuery this) on: ‘click’ do: (html jQuery ajax callback:[ … ])
with: [ self renderSelectOn: html ]
It probably will require some more complex handling with respect to getting the correct events sorted out…
I did not try these things, so I hope this helps
> On 16 Jan 2015, at 16:54, Mariano Martinez Peck <marianopeck at gmail.com> wrote:
> Hi guys,
> I have a html select list that then I convert to a UL / LI kind of list using Bootstrap select: https://github.com/silviomoreto/bootstrap-select <https://github.com/silviomoreto/bootstrap-select>
> I want to make it sortable (which I could) but I cannot correctly hook onto the stop of the drop so that I can update my model/backend side.
> I am trying to do something like:
> html script: ((html jQuery id: '#myULList')
> onStop: (html jQuery ajax
> callback: [ :values | values asOrderedCollection inspect ]
> passengers: (html jQuery this find: 'li')))
> Basically...I need to get 'values' with my real objects. The problem is that since I am not rendering the LI items myself (but bootstrap select does), I cannot specify the passenger..I mean...I cannot do something like "html listItem passenger: each" or whatever...
> Any ideas how can I make it work?
> Thanks in advance,
> http://marianopeck.wordpress.com <http://marianopeck.wordpress.com/>
> seaside mailing list
> seaside at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside