Hi,

I'm trying to organize several places defined in a table called
db.plads into ordered routes. I'm trying to use the sortable plugin
(http://web2py.com/plugins/default/sortable) to allow me to order the
route.

The places on the route are showing up correctly, but when I click to
drag and re-order, instead of re-ordering the route, it's just
selecting text. I think the problem is with the callback or the query
used in the call back.

Here's the relevant code that I have:

Model:

db.define_table('routeinfo',
                Field('name'),
                format = '%(name)s')

db.define_table('routedetails',
                Field('route', db.routeinfo),
                Field('plads', db.plads),
 
Field('sortable','integer',default=0,writable=False,readable=False))


Controller:

def showroute():
    routeinfo = db.routeinfo(request.args(0)) or
redirect(URL('index'))
    places =
routeinfo.routedetails.select(orderby=db.routedetails.sortable)
    return dict(routeinfo = routeinfo, places=places)

def sortroute():
 
plugin_sortable_sort(db.routedetails,query=db.routedetails.id==request.args(0))


View:

{{extend 'layout.html'}}
<style>
.sortable LI {
   width: 200px; background: orange; color: white;
   border: 2px solid white; padding: 5px 5px 5px 5px;
    -moz-border-radius: 5px; -webkit-border-radius: 5px;
    z-index: 2;
}
</style>
{{=plugin_sortable([(f.id, f.plads.name) for f in places],
callback=URL(r=request, f='sortroute'))}}



Any idea why this isn't working?

Reply via email to