I tested your code but it isnt go. Ther is my code:
--------------------------------------------------------------------------
SQL Table:
===============
name_tabel: section
id: int
name: varchar
position: int
Section Model:
===========
<?php
class Section extends AppModel {
var $name = 'Section';
}
?>
Section Controller:
=============
<?php
class SectionsController extends AppController {
var $name = 'Sections';
var $uses = 'Section';
var $helpers = array('Html', 'Form', 'Ajax');
function index() {
$this->set('sections', $this->Section->findAll());
}
function order(){
$ids= $this->params['form']['sections'];
$i = 1;
foreach($ids as $id){
$this->Section->id = $id;
$this->Section->saveField('position', $i++);
}
}
}
?>
Section Views:
=============
INDEX VIEW
<ul id="sections">
<?foreach($sections as $section){?>
<li id="section_<?= $section['Section']['id']?>">
<? echo $section['Section']['name'].' Position:
'.$section['Section']['position']; ?></li>
<?}?>
</ul>
<?= $ajax->sortable('sections',array('onUpdate' => " function(t){new
Ajax.Request( '/sections/order', {method:'post',
postBody:Sortable.serialize('sections'), asynchronous:true})}"))?>
I test it with FireBag in Firefox v2, when I resort some section. Its
return dont finde controller becouse it finding method order on link
http://localhost/sections/order. So when I change: <?=
$ajax->sortable('sections',array('onUpdate' => " function(t){new
Ajax.Request( '/sections/order', {method:'post',
postBody:Sortable.serialize('sections'), asynchronous:true})}"))?>
on
<?= $ajax->sortable('sections',array('onUpdate' => " function(t){new
Ajax.Request( 'http://localhost/zakazky/eshop/sections/order',
{method:'post',
postBody:Sortable.serialize('sections'), asynchronous:true})}"))?>
its return isnt view for method order, but position section is save.
THX
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---