Hey Folks:

I have a question regarding AppFuse, script.aculo.us, and AJAX.


script.aculo.us includes a REALLY useful and slick feature of
"Sortable" lists, 
that allow users to drag and drop items around the screen, arranging the
items 
as they like. (See demo
http://wiki.script.aculo.us/scriptaculous/page/print/GhostlySortableDemo 
here : 
http://wiki.script.aculo.us/scriptaculous/page/print/GhostlySortableDemo
http://wiki.script.aculo.us/scriptaculous/page/print/GhostlySortableDemo )


According to the script.aculo.us
http://wiki.script.aculo.us/scriptaculous/show/Sortable.serialize
documentation  (
http://wiki.script.aculo.us/scriptaculous/show/Sortable.serialize
http://wiki.script.aculo.us/scriptaculous/show/Sortable.serialize ), 
the final list can be "serialized" and then used to submit (HTTP
POST) the order 
of the Sortable via an Ajax call.




I am currently running AppFuse 1.9.4 with WebWork (though I am considering 
moving to 2.0 with Struts 2 real soon - looks great). I'm using Tomcat
5.5.23, MySQL 5.0.45, and Linux (Ubuntu). Typically, I use FireFox 2.0.0.6
as my 
browser.


In my application, each user can have their own set of favorite items, and
order 
them as they please. Currently, I am implementing this with a 'select' and
using 
the moveOptionUp()/moveOptionDown() scripts that Matt Raible bundled in the 
selectbox.js file. No probs.


Nonetheless, I thought this "Sortable" feature would be a
super-duper UI to 
enable a quick, easy, sexy drag-and-drop user experience for arranging a
list of 
favorites. So I gave it a try.


I can render the favorites list on the screen easily using a WebWork
iterator:





<ul id="userFavoritesList">

<ww:iterator value="user.favoritesList">

<li><ww:property value="id"/>: <ww:property
value="favorite"/></li>

</ww:iterator>

</ul>


<script type="text/javascript">

Sortable.create('userFavoritesList',{ghosting:true,constraint:false})

</script>



The "Sortable" works great, allowing me to arrange the items
willy-nilly. I love 
it! Just the kind of sexy user experience I was hoping for.




HERE'S MY PROBLEM:

Once I have re-arranged this list on screen, how do I submit/commit this
newly 
ordered list back to the application/database? Has anyone tried this? I
guess I 
serialize the list, as mentioned in the script.aculo.us 
http://wiki.script.aculo.us/scriptaculous/show/Sortable.serialize
documentation  mentioned 
above. How exactly do I capture this serialized object in the Java
application? 
Once I get that rearranged list back into the Action as a List object (or
other 
native Java Collection) I am confident I can take things form there.... but 
exactly how?



Hopefully, someone has tried this within the framework of AppFuse, and will
be 
able to give a short reply, but I would also love to hear from folk who
haven't 
tried it, and are also interested. Likewise, if someone thinks I'm asking a 
dopey question, then go ahead and say so. Or perhaps redirect me to another 
website that spells this sort of thing out. It's all good.


Thanks in advance!


JB




-- 
View this message in context: 
http://www.nabble.com/AppFuse%3A-script.aculo.us-Sortable-Lists-Question-tf4351829s2369.html#a12400179
Sent from the AppFuse - User mailing list archive at Nabble.com.

Reply via email to