Hi,
We have a such component in exanpe-t5-lib, but not implemented with JQuery.
You can have a look at our online demo here : 
http://exanpe-t5-lib.appspot.com/components/listsorter/example1

Laurent

-----Message d'origine-----
De : sommeralex [mailto:alexander.som...@gmail.com] 
Envoyé : lundi 13 février 2012 16:07
À : users@tapestry.apache.org
Objet : implementing a sortable list with jQuery

Hi!

I need to have sortable list by dragging the list elements and would like to 
store the order at the end.

The http://tapestry5-jquery.com/core/docsgrid does not provide a component, so 
i thought i could take this one:
http://blogs.fau.de/pp/2010/09/01/sortierbare-elemente-in-tapestry-per-jquery-ui/

What i did, so far, is this:

<html t:type="layout" t:title="Welcomes" t:tabTitle="Scrollstory"
      t:sidebarTitle="Menu"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd";
      xmlns:p="tapestry:parameter"
    xmlns:j="tapestry-library:jquery">
    
    
    
   

<ul id="sortable">
<li t:type="loop" source="fileElements" value="fileElement"
id="${fileElement.id}">${fileElement.id} ${fileElement.name}</li> </ul> # 
${message:save} <t:actionlink t:id="save" 
context="literal:dummy"></t:actionlink>

</html>

And my class file:

@Property
private List<FileElement> fileElements;
        
@Property
private FileElement fileElement;

        void pageAttached(){
                System.out.println("page attached");
                uploadedFiles = new ArrayList<UploadedFile>();
                fileElements = new ArrayList<FileElement>();
                
                fileElements.add(new FileElement(1, "test"));
                fileElements.add(new FileElement(2, "test2"));
        }

the class FileElement is just a class with id as int and name as String with 
getters / setters. 

so, now, two questions:

question 1:
http://blogs.fau.de/pp/2010/09/01/sortierbare-elemente-in-tapestry-per-jquery-ui/
says we have to implement 

<link type="text/css" href="${asset:jqueryui/themes/base/jquery.ui.all.css}"
rel="stylesheet" />






but, is this not implicit in xmlns:j="tapestry-library:jquery ? if i have to 
add this that way, how can i reference my jquery asset which is stored in my 
mvn. folder?

question 2:

if i am adding the second part of code

function storeOrder() {
var result = $('#sortable').sortable('toArray');
var context = "";
for (var id in result) {
if (context == "") {
context = result[id];
} else {
context = context + "_" + result[id];
}
}
window.location = "/${pageName}" + ".save/" + context; }

i get the exception 

Exception assembling root component of page Gallery: Could not convert 
'pageName' into a component parameter binding: Exception generating conduit for 
expression 'pageName': Class com.scrollstory.pages.Gallery does not contain a 
property (or public field) named 'pageName'.

.. so, sorting my list does not work.. :-(



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/implementing-a-sortable-list-with-jQuery-tp5479509p5479509.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to