So... in short :
___________________ VIEW ( index.thtml ) ______________________
<ul id="items">
<?foreach($items as $item){?>
<li id="item_<?= $item['Item']['id']?>"><?=
$item['Item']['title']?></li>
<?}?>
</ul>
<?= $ajax->sortable('items',array('onUpdate' => " function(t){new
Ajax.Request( '/items/order', {method:'post',
postBody:Sortable.serialize('items'), asynchronous:true})}"))?>
________________ CONTROLLER ( items_controller.php ) ________________
function order(){
$ids= $this->params['form']['items'];
$i = 1;
foreach($ids as $id){
$this->Item->id = $id;
$this->Item->saveField('position', $i++);
}
___________________ DATABASE ______________________
table 'items' which has field called 'position'
I'm not using Items in my source, so there might be some mistakes, but
thats the main idea :)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---