Damn...i did it... i was playing with
$ajax->sortable('items',array('url' => '/items/order')) ... for example
I use firebug to catch the request - the parameters are wrong... it
seems that they are not in UTF-8.
The ajax helper generates js that prints ....
parameters:sortable.serialize('items') ....
Instead use sth. like :
<?= $ajax->sortable('items',array('onUpdate' => " function(t){new
Ajax.Request( '/items/order', {method:'post',
postBody:Sortable.serialize('items'), asynchronous:true})}"))?>
If you wish you can fix the ajaxhelper instead of writing that js every
time.
And the function that catches that request :
function order(){
$ids= $this->params['form']['items'];
$i = 1;
foreach($ids as $id){
$this->Item->id = $id;
$this->Item->saveField('position', $i++);
}
note: Your 'items' db table must have 'position' field
Hope i helped :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---