Hi,<br>How does one save a sorted list back in the image ?<br>The details are as below.<br><br>ListView>> renderContentOn: html<br>html form: [<br>html render: self model title.<br>html div class: 'items';<br>
script: (html sortable tag: 'div';<br> <br> onUpdate: (html request<br> triggerSortable: 'items'<br> callback: [:col | self model items: col]));
<br> with: [<br> self model items do: [:eachItem| self renderItemOn:eachItem].<br> html submitButton callback: [self answer: self model]]]<br><br>ListView>> renderItemOn: anItem
<br>html<br> table: [html<br> tableRow: [html tableData id: 'checkBoxItem';<br> <br> with: [html checkbox value: anItem done;<br>
<br> callback: [:value | anItem done: value]].<br> html tableData id: 'myListEditItems';<br> passenger: anItem;<br> with: [
<br> html render: anItem title]]]<br><br><br>The page is rendered and the items can be sorted. The sorting is only done on the client end. If I submit the button, the new order of the items isn't updated. Am I missing anything ?
<br><br>a) I tried to introduce a self halt in <br><br>html sortable tag: 'div';<br>
<br>
onUpdate: (html request<br>
triggerSortable: 'items'<br>
callback: [:col | <span style="color: rgb(255, 0, 0);">self halt.</span>self model items: col]));<br><br>It didn't halt for debugging.<br><br><br>b) I tried to introduce a temp variable which stores items, as follows,
<br><br>ListView>> renderContentOn: html<br>| tempList |<br><span style="color: rgb(255, 0, 0);">tempList := List new.</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">tempList items: self model items.
</span><br>
html form: [<br>
html render: self model title.<br>
html div class: 'items';<br>
script: (html sortable tag: 'div';<br>
<br>
onUpdate: (html request<br>
triggerSortable: 'items'<br>
callback: [:col | <span style="color: rgb(255, 0, 0);">tempList</span> items: col]));<br>
with: [<br>
<span style="color: rgb(255, 0, 0);"> tempList</span> items do: [:eachItem| self renderItemOn:eachItem].<br>
html submitButton callback: [<span style="color: rgb(255, 0, 0);">self model items: tempList items.</span>self answer: self model]]]<br><br><br>I knew this wouldn't work either as I had failed earlier to update items (which is an OrderCollection) by duplicating it and reassigning after changes.
<br><br>By googling around, I found a solution that has been implemented in PHP.<br><br><a href="http://www.zenperfect.com/2007/07/26/sortable-lists-in-php-walkthrough/">http://www.zenperfect.com/2007/07/26/sortable-lists-in-php-walkthrough/
</a><br><br><br>I am not able to comprehend it properly.<br><br>In a nutshell, I have a list saved in my squeak image, I retrieve the list for sorting. After sorting it, it should be saved in the submitted order. <br><br>
Hoping to find some help,<br>Rajeev<br><br>PS: I am using Damien's 2.8 image<br><br><br><br clear="all"><br>-- <br>Rajeev Lochan<br><br>Co-founder, AR-CAD.com<br><br><a href="http://www.ar-cad.com">http://www.ar-cad.com
</a><br>+91 9243468076 (Bangalore)<br>080 65355873