script.aculo.us Ajax Sortable mit Perl
http://zenofshen.com/posts/ajax-sortable-lists-tutorial in Perl.
if (defined(param('data'))) {
my $sort_data = param('data');
$sort_data =~ s/\w+\[\d*\]\=//g;
my $i = 0;
foreach my $id (split(/\&/,$sort_data)) {
$sql = "update TABLE_X set weight=" .$dbh->quote($i++)." where id=" . $dbh->quote($id);
}
}
Sortable.create('DOM_ID',{
onUpdate: function() {
new Ajax.Request("x.pl", {
method: "post",
parameters: { data: Sortable.serialize('DOM_ID') }
});
}
});
onUpdate: function() {
new Ajax.Request("x.pl", {
method: "post",
parameters: { data: Sortable.serialize('DOM_ID') }
});
}
});
- Stefan Rieger's blog
- Anmelden um Kommentare zu schreiben