Hi,
I used to use scriptaculous in all my cakephp projects because of its easy helpers. In time, i got more and more into jquery and now I want to replace my current scriptaculous script with jquery. Until now > everything is good. Except jquery sortable.
Jquery sortable runs, but the ajax call after isn't working right. Now my programmer is on holiday so I've gotta ask you guys:
Old cakephp code (inside pages_controller.php):
function order($parent_id = 0){
$this->autoRender=false;
//Users with rights may view this
$user = $this->checkRights('pages',true);
//loop through the data sent via the ajax call
foreach ($this->params['form']['page'] as $order => $id){
$this->Page->id = $id;
if(!$this->Page->saveField('order',$order)) {
$this->flash('Really freaky errors are occuring','/');
exit();
}
}
}
My jquery looks like:
$(".sortable-list").sortable({
update: function() {
$.post('/pages/order/0', {
data: $('.sortable-list').sortable("serialize")
});
}
});
$(".sortable-list").disableSelection();
With firebug, I see that the ajax post call produces something like this:
page[]=14&page[]=23&page[]=18&page[]=11&page[]=26&page[]=28
However, it doesn't seem to work. I guess the page[]=id is different that the old scriptaculous format:
pages_0[] 1
pages_0[] 3
pages_0[] 2
However, does anyone know how i can adjust the cakephp file to read the string correctly?
Thx alot!