Yes. Adding #asOrderedCollection would fix the problem I think. Trying it out now.
Pe 13 feb. 2015, la 12:03, Carlo <snoob...@gmail.com> a scris: > Hi > > I assume that your _itemList variable is set via self model items: items. > If so then it looks like it will become an array due to the > callback:passengers: sent to JQAjax: > (html jQuery ajax > callback: [:items | self model items: items] > passengers: (html jQuery this find: 'li') > > The implementation: > callback: aBlock passengers: aQuery > "Trigger the callback aBlock with the passengers of aQuery. Nodes that > have no passenger are ignored." > > self > callback: [ :value | > aBlock value: (((value subStrings: ',') > collect: [ :each | self renderContext callbacks > passengerAt: each ]) > reject: [ :each | each isNil ]) ] > value: (JSStream on: JQuery functionName , '.map(' , aQuery > greaseString , '.get(),function(each){return each.id}).join(",")') > > uses (value subStrings: ',') which will return an array. > You could modify your setter accessor items: to modify the collection using > asOrderedCollection if you need this...? > > Kind Regards > Carlo > > > On 13 Feb 2015, at 11:26 AM, Mircea S. <mir...@unom.ro> wrote: > > The code below is form the Seaside book at: > http://book.seaside.st/book/web-20/jquery/enhanced-todo-application/drag-and-drop > > > > ToDoListView>>renderContentOn: html > > self renderHeadingOn: html. > html form: [(html unorderedList) > id: (listId := html nextId); > script: ((html jQuery new sortable) > onStop: (html > jQuery ajax > callback: [:items > | self model items: items] > passengers: (html > jQuery this find: 'li')); > axis: 'y'); > with: [self renderItemsOn: html]. > > (html submitButton) > callback: [self add]; > text: 'Add']. > html render: editor > > My instance variable _itemList is initially OrderedCollection. As soon as I > move the rows around in the page then entire list is sent back in it's new > order. However, this time setItemList: receives an Array. > > Does this make any sense? Am I missing something? > > >