How to change the selection of AjaxSelectionList
How to change the selection of AjaxSelectionList
- Subject: How to change the selection of AjaxSelectionList
- From: Helmut Schottmüller <email@hidden>
- Date: Sun, 6 Apr 2008 13:46:33 +0200
Hi,
I tried to use AjaxSelectionList. Additional to the example in the
AjaxExamples I like to add buttons to move elements up and down.
Moving up I realised in the following way:
"Move up" is bound to this method:
int index = itemlist.indexOfObject(selectedItem);
if (index > 0)
{
MyObject temp = itemlist.objectAtIndex(index-1);
itemlist.removeObjectAtIndex(index-1);
itemlist.insertObjectAtIndex(temp, index);
selectedItem = itemlist.objectAtIndex(index-1);
}
return null;
where itemlist is my NSArray of MyObjects and selectedItem is bound to
the selection binding.
Selecting the last element and pressing the "Move up" button, the code
is executed and the last element changes position with the element
before. Works fine.
Pressing the "Move up" button again does not work as expected
unfortunately. It seems that in the JavaScript code the selection is
still on the last item. So when the method is called for the next
time, the selectedItem is no longer the item which was the
selectedItem when the method was finished the last time.
Is there any way to synchronize the JS with the WO results?
Regards,
Helmut
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