[Seaside] What to write in the "onDrop:" ?

Sebastian Nozzi sebnozzi at googlemail.com
Thu Aug 13 13:20:59 UTC 2009


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.


More information about the seaside mailing list