Re: Setting field value of object based on position in AjaxSortableList
Re: Setting field value of object based on position in AjaxSortableList
- Subject: Re: Setting field value of object based on position in AjaxSortableList
- From: Chuck Hill <email@hidden>
- Date: Wed, 15 Jun 2011 13:12:17 -0700
On Jun 15, 2011, at 12:43 PM, Jaime Magiera wrote:
> Hi folks,
>
> I'm starting to delve into Ajax with WO. In particular, AjaxSortableList.
>
> I've got a top level object ("Archive") that has a to-many ("Links"). Each Link has an "index" field so that the link items can be displayed to users in the desired order. I'm trying to wrap my head around a way to write that field based on the what position the editor drags the link to within an AjaxSortableList. In other words, when a Link item is dragged, its position in the list is written to its index field. Probably an easy thing, but I'm not figuring it out yet.
>
> thanks for any thoughts,
The thing is, that many things in Ajax.framework don't work as people expect them to. They work well, but sometimes come at the problem from a direction other than what one might first expect. Or might want for their specific case. I have never used AjaxSortableList, but I suspect this is what you are seeing.
From looking at the code, AjaxSortableList re-orders a list. It does not tell your code what elements to move or what was moved, it just moves them. Then it calls the method bound to action. You could bind action, and in this method iterate over the list and manually set the new index to reflect it's place in the list. Or you could do that in the method on your page that sets the list when AjaxSortableList changes it.
Chuck
>
> Jaime Magiera
>
> Sensory Research, Inc.
> http://www.sensoryresearch.net
>
>
>
>
>
>
>
> _______________________________________________
> 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
--
Chuck Hill Senior Consultant / VP Development
Come to WOWODC this July for unparalleled WO learning opportunities and real peer to peer problem solving! Network, socialize, and enjoy a great cosmopolitan city. See you there! http://www.wocommunity.org/wowodc11/
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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