Hi,
How does one save a sorted list back in the image ? The details are as below. ListView>> renderContentOn: html html form: [ html render: self model title. html div class: 'items'; script: (html sortable tag: 'div'; onUpdate: (html request triggerSortable: 'items' callback: [:col | self model items: col])); with: [ self model items do: [:eachItem| self renderItemOn:eachItem]. html submitButton callback: [self answer: self model]]] ListView>> renderItemOn: anItem html table: [html tableRow: [html tableData id: 'checkBoxItem'; with: [html checkbox value: anItem done; callback: [:value | anItem done: value]]. html tableData id: 'myListEditItems'; passenger: anItem; with: [ html render: anItem title]]] 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 ? a) I tried to introduce a self halt in html sortable tag: 'div'; onUpdate: (html request triggerSortable: 'items' callback: [:col | self halt.self model items: col])); It didn't halt for debugging. b) I tried to introduce a temp variable which stores items, as follows, ListView>> renderContentOn: html | tempList | tempList := List new. tempList items: self model items. html form: [ html render: self model title. html div class: 'items'; script: (html sortable tag: 'div'; onUpdate: (html request triggerSortable: 'items' callback: [:col | tempList items: col])); with: [ tempList items do: [:eachItem| self renderItemOn:eachItem]. html submitButton callback: [self model items: tempList items.self answer: self model]]] 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. By googling around, I found a solution that has been implemented in PHP. http://www.zenperfect.com/2007/07/26/sortable-lists-in-php-walkthrough/ I am not able to comprehend it properly. 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. Hoping to find some help, Rajeev PS: I am using Damien's 2.8 image -- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
There are many different problems with your approach:
> ListView>> renderContentOn: html > html form: [ > html render: self model title. > html div class: 'items'; > script: (html sortable tag: 'div'; > onUpdate: (html request > triggerSortable: 'items' > callback: [:col | self model items: col])); If you say the sortable should use 'div' tags, then all elements inside your container should be of that kind. Check out the method comment of #tag: > with: [ > self model items do: [:eachItem| self > renderItemOn:eachItem]. > html submitButton callback: [self answer: self model]]] Uhh, the button should be outside the container. > ListView>> renderItemOn: anItem > html > table: [html > tableRow: [html tableData id: 'checkBoxItem'; > > with: [html checkbox value: anItem done; > > callback: [:value | anItem done: value]]. > html tableData id: 'myListEditItems'; > passenger: anItem; > with: [ > html render: anItem title]]] The sortable elements should be DIV-tags, if you declare them to be DIVs. Tables in general don't work together with drag&drop, so avoid them altogether (see documentation of script.aculo.us). Furthermore you need to assign the #passenger: to the direct child of the container (the DIV). Again see the documentation of script.aculo.us. > 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 ? That's because you tell Scriptaculous to only consider div-tags, but you add table-tags as children. Have a look at SUSortableTest for a working example. HTH, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks Lukas,
I shall incorporate changes and come back On 8/29/07, Lukas Renggli <[hidden email]
> wrote: There are many different problems with your approach: -- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hi Lukas,
As suggested by you, I made the following changes. ListView>> renderContentOn:html html form: [ html render: self model title. html div class: 'items'; script: (html sortable tag: 'div'; onUpdate: (html request triggerSortable: 'items' callback: [:col | self model items: col])); with: [ self model items do: [:eachItem| self renderItemOn:eachItem]. html submitButton callback: [self answer: self model]; text:'Update' ListView>> renderItemOn: html html div id: 'myListEditItems'; passenger: anItem; with: [ html render: anItem title] When I try to update it, its not being done. The self halt introduced earlier in onUpdate: (html request triggerSortable: 'items' callback: [:col |self halt. self model items: col])); is also not stopped for debugging. I Followed through the SUSortableTest to catch up a few hints. But that seemed to be very complex compared to the situation we have here. I also tried html div class: 'myListEditItems'; But no progress either. Where i am i falling down ?? Rajeev
On 8/29/07, Rajeev Lochan <[hidden email]> wrote: Thanks Lukas, -- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hi,
I had tried to imitate what you(Lukas) had posted on http://www.lukas-renggli.ch/smalltalk/seaside/web20.txt I also changed the renderItemOn: code after crosschecking from your site to html div passenger: anItem; with: [ html render: anItem title] Still I am not able to figure out the solution. Regards, Rajeev On 8/29/07,
Rajeev Lochan <[hidden email]> wrote: Hi Lukas, -- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I just added to the Scriptaculous package a new example SUSortableTest
(the old one is renamed to SUSortableDoubleTest). Name: Scriptaculous-lr.216 Author: lr Time: 28 August 2007, 11:55:19 pm UUID: 74f452a8-083b-4155-bf82-aa83ff8ace0d Ancestors: Scriptaculous-lr.215 - added a trivial example of sortable lists The code is as simple as: initialize super initialize. collection := #( 'San Salvatore' 'Monte Bre' 'Calvagione' ) renderContentOn: html | id | html unorderedList id: (id := html nextId); script: (html sortable onUpdate: (html request triggerSortable: id callback: [ :value | collection := value ])); with: [ self renderListItemsOn: html ] renderListItemsOn: html collection do: [ :each | html listItem passenger: each; with: each ] On 8/28/07, Rajeev Lochan <[hidden email]> wrote: > Hi, > > I had tried to imitate what you(Lukas) had posted on > > http://www.lukas-renggli.ch/smalltalk/seaside/web20.txt > > I also changed the renderItemOn: code after crosschecking from your site to > > html div > passenger: anItem; > with: [ > html render: anItem title] > > > Still I am not able to figure out the solution. > > Regards, > > Rajeev > > > On 8/29/07, Rajeev Lochan <[hidden email]> wrote: > > Hi Lukas, > > > > As suggested by you, I made the following changes. > > > > ListView>> renderContentOn:html > > html form: [ > > html render: self model title. > > html div class: 'items'; > > script: (html sortable tag: 'div'; > > > > onUpdate: (html request > > triggerSortable: 'items' > > callback: [:col | self model items: col])); > > with: [ > > self model items do: [:eachItem| self > renderItemOn:eachItem]. > > html submitButton callback: [self answer: self model]; text:'Update' > > > > > > ListView>> renderItemOn: html > > > > html div id: 'myListEditItems'; > > passenger: anItem; > > with: [ > > html render: anItem title] > > > > When I try to update it, its not being done. The self halt introduced > earlier in > > > > onUpdate: (html request > > triggerSortable: 'items' > > callback: [:col |self halt. self model items: col])); > > > > is also not stopped for debugging. > > > > I Followed through the SUSortableTest to catch up a few hints. But that > seemed to be very complex compared to the situation we have here. > > > > I also tried html div class: 'myListEditItems'; But no progress either. > > > > Where i am i falling down ?? > > > > Rajeev > > > > > > > > > > > > > > > > > > > > On 8/29/07, Rajeev Lochan <[hidden email]> wrote: > > > Thanks Lukas, > > > I shall incorporate changes and come back > > > > > > > > > > > > > > > > > > On 8/29/07, Lukas Renggli < [hidden email] > wrote: > > > > There are many different problems with your approach: > > > > > > > > > ListView>> renderContentOn: html > > > > > html form: [ > > > > > html render: self model title. > > > > > html div class: 'items'; > > > > > script: (html sortable tag: 'div'; > > > > > onUpdate: (html request > > > > > triggerSortable: 'items' > > > > > callback: [:col | self model items: col])); > > > > > > > > If you say the sortable should use 'div' tags, then all elements > > > > inside your container should be of that kind. Check out the method > > > > comment of #tag: > > > > > > > > > with: [ > > > > > self model items do: [:eachItem| self > > > > > renderItemOn:eachItem]. > > > > > html submitButton callback: [self answer: self > model]]] > > > > > > > > Uhh, the button should be outside the container. > > > > > > > > > ListView>> renderItemOn: anItem > > > > > html > > > > > table: [html > > > > > tableRow: [html tableData id: 'checkBoxItem'; > > > > > > > > > > with: [html checkbox value: anItem done; > > > > > > > > > > callback: [:value | > anItem done: value]]. > > > > > html tableData id: 'myListEditItems'; > > > > > passenger: anItem; > > > > > with: [ > > > > > html render: anItem title]]] > > > > > > > > The sortable elements should be DIV-tags, if you declare them to be > > > > DIVs. Tables in general don't work together with drag&drop, so avoid > > > > them altogether (see documentation of script.aculo.us). > > > > > > > > Furthermore you need to assign the #passenger: to the direct child of > > > > the container (the DIV). Again see the documentation of > > > > script.aculo.us. > > > > > > > > > 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 ? > > > > > > > > That's because you tell Scriptaculous to only consider div-tags, but > > > > you add table-tags as children. > > > > > > > > Have a look at SUSortableTest for a working example. > > > > > > > > HTH, > > > > Lukas > > > > > > > > -- > > > > Lukas Renggli > > > > http://www.lukas-renggli.ch > > > > _______________________________________________ > > > > Seaside mailing list > > > > [hidden email] > > > > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > > > > > > > > > > > > > > > > > > -- > > > Rajeev Lochan > > > > > > Co-founder, AR-CAD.com > > > > > > http://www.ar-cad.com > > > +91 9243468076 (Bangalore) > > > 080 65355873 > > > > > > > > -- > > Rajeev Lochan > > > > Co-founder, AR-CAD.com > > > > http://www.ar-cad.com > > +91 9243468076 (Bangalore) > > 080 65355873 > > > > -- > Rajeev Lochan > > Co-founder, AR-CAD.com > > http://www.ar-cad.com > +91 9243468076 (Bangalore) > 080 65355873 > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks for updating, I tried the following stuff and it worked. :)
html unorderedList id: 'sortItems'; script: (html sortable onUpdate: (html request triggerSortable: 'sortItems' callback: [:col | self model items: col])); with: [ self model items do: [ :each | html listItem passenger: each; with: each title]]. html submitButton callback: [self answer: self model} As a matter of fact, I also tried the following things (Just in case anyone like me wants more out of sorting list), you can also edit using textInput ... html orderedList id: 'sortItems'; script: (html sortable onUpdate: (html request triggerSortable: 'sortItems' callback: [:col | self model items: col])); with: [ self model items do: [ :each | html listItem passenger: each; with: [self renderItemEditOn: each on: html]]]. html submitButton.... ListView >> renderItenEditOn: each on: html renderItemFalse: anItem on: html html textInput value: anItem title; callback: [:value | anItem title: value] Thanks a lot Lukas for the wonderful work of porting scriptaculous to Seaside and helping the whole seaside community. Regards, Rajeev
On 8/29/07, Lukas Renggli <[hidden email]> wrote: I just added to the Scriptaculous package a new example SUSortableTest -- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Is it possible to get the exact URL string the user typed into the browser
to access a Seaside app? -Carl Gundel http://www.runbasic.com _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> Is it possible to get the exact URL string the user typed into the browser
> to access a Seaside app? I am sure that you can get this information somewhere from self session currentRequest Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Rajeev Lochan
Hi Lukas,
The code mentioned in the earlier mail works fine with FireFox 2.0, When you sort the "ordered List" , the numbers to the left are also updated accordingly. Today I tried to do the same thing in IE 6.0.2900, the sorting of items is done, but the number associated with respective listItem remains with it even after sorting it., Only after a browser refresh, the numbers are updated. Is this a bug or I have some problem in my code. How exactly do I use userAgent ?? Do distinguish between different browser and render the code accordingly (If at all it is done this way) Thanks in advance, Rajeev
On 8/29/07, Rajeev Lochan <[hidden email]> wrote: Thanks for updating, I tried the following stuff and it worked. :) -- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> The code mentioned in the earlier mail works fine with FireFox 2.0, When you
> sort the "ordered List" , the numbers to the left are also updated > accordingly. Today I tried to do the same thing in IE 6.0.2900, the sorting > of items is done, but the number associated with respective listItem remains > with it even after sorting it., Only after a browser refresh, the numbers > are updated. Is this a bug or I have some problem in my code. I tried to reproduce, but it works for me on IE 6.0.9800. Can you provide more information to reproduce? > How exactly do I use userAgent ?? Do distinguish between different browser > and render the code accordingly (If at all it is done this way) You should never use userAgent. This will break your code sooner or later ... Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |