Hello Seasiders,
I am having trouble understanding how to make the Javascript (Scriptaculous) part talk to the Smalltalk one. Using Seaside 2.8. What I want to have are mouse-movable DIVs (which represend model objects) that remember their position the next time they are rendered. For that, I would like to know how to pass the coordinates (offset) from a dropped DIV back to the Smalltalk side and store that property in one model object. I've seen that SUElement provides something like this, but I'm clueless as to what to write in the #onDrop: part of my droppable to make the connection. It should extract the information via... Javascript? DOM? and send it back as a ajax-request to the server/smalltalk side... I am correct? The modified snippets would look like these: "Render the drop-container" html div script: (html droppable accept: 'myDraggableClass'; onDrop: "..." ); with:[ ... "Render the DIVs to be dragged inside container" myElements do:[:e | html div passenger: e; class: 'myDraggableClass'; script:(html draggable); with:'dragMe']. ...]. Any hints? Are there examples on the use of SUElement and co.? Thanks in advance! Sebastian. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hey Sebastian,
in my Bachelor Thesis, I do something like that this way: html div id: myID; onMouseOver: (html draggable onEnd: (html request callback: [:value | self updatePositionOf: aPassenger with: value.] value: (html element id: myID) positionedOffset)); where value is a String in the form (x,y). Am 13.08.2009 um 15:20 schrieb Sebastian Nozzi: > Hello Seasiders, > > I am having trouble understanding how to make the Javascript > (Scriptaculous) part talk to the Smalltalk one. Using Seaside 2.8. > > What I want to have are mouse-movable DIVs (which represend model > objects) that remember their position the next time they are rendered. > > For that, I would like to know how to pass the coordinates (offset) > from a dropped DIV back to the Smalltalk side and store that property > in one model object. I've seen that SUElement provides something like > this, but I'm clueless as to what to write in the #onDrop: part of my > droppable to make the connection. > > It should extract the information via... Javascript? DOM? and send it > back as a ajax-request to the server/smalltalk side... I am correct? > > The modified snippets would look like these: > > "Render the drop-container" > html div script: (html droppable accept: 'myDraggableClass'; > onDrop: "..." ); with:[ ... > > "Render the DIVs to be dragged inside container" > myElements do:[:e | html div passenger: e; > class: 'myDraggableClass'; > script:(html draggable); > with:'dragMe']. > > ...]. > > Any hints? Are there examples on the use of SUElement and co.? > > Thanks in advance! > > Sebastian. > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hello Richard,
this is great! Thanks for your answer. I'll try it out as soon as I can. I didn't consider the approach to do something on the draggable, instead of the droppable... Also, I might have misunderstood or overseen how to use callback:value: Is it always used like that? (the value part "extracting" or executing Javascript info) Thanks again, Sebastian 2009/8/13 [hidden email] <[hidden email]>: > Hey Sebastian, > > in my Bachelor Thesis, I do something like that this way: > > html div id: myID; > onMouseOver: (html draggable > onEnd: (html request > callback: [:value | > self updatePositionOf: aPassenger with: value.] > value: > (html element id: myID) positionedOffset)); > > where value is a String in the form (x,y). seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Happy to help ^^
I think it is always used like that since the comment says: "Register aBlock as a secondary callback. anObject is interpreted as JavaScript on the client-side, the result will be sent back to the server and passed into aBlock. Multiple secondary callbacks can be defined with one receiver." RD Am 13.08.2009 um 15:59 schrieb Sebastian Nozzi: > Hello Richard, > > this is great! Thanks for your answer. I'll try it out as soon as I > can. > > I didn't consider the approach to do something on the draggable, > instead of the droppable... > > Also, I might have misunderstood or overseen how to use > callback:value: > Is it always used like that? (the value part "extracting" or executing > Javascript info) > > > Thanks again, > > Sebastian > > > 2009/8/13 [hidden email] <[hidden email]>: >> Hey Sebastian, >> >> in my Bachelor Thesis, I do something like that this way: >> >> html div id: myID; >> onMouseOver: (html draggable >> onEnd: (html request >> callback: [:value | >> self updatePositionOf: aPassenger with: value.] >> value: >> (html element id: myID) positionedOffset)); >> >> where value is a String in the form (x,y). > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |