Thanks again for your help.

I have spent the last hour reading through the documentation and
working through the example and
also your notes.  I believe I am getting closer, but I did not
understand how your:

foreach($_POST['order'] as $k=>$v){
        if($item = ActiveRecord::FindById('items',$v){
                $v->position = $k+1;

would be implemented.  I have a code file which my AJAX requests are
passed through, which contains the code:

        require_once ('chunkslist.class.php');

        $myChunksList = new ChunksList();

        $action = $_GET['action'];
        $chunkTitle = $_GET['chunkTitle'];
        $chunkContent = $_GET['chunkContent'];
        $order = $_GET['order'];

        echo $myChunksList->Process($chunkTitle, $chunkContent, $order,

in this "$order = $_GET['order'] is the line i have added to handle
the following call:

if (action == "recreateList")
                        params = "?chunkTitle=" + null + "&chunkContent=" + 
null +
"&order=" + fooOrder + "&action=recreateList";

the other parts of the javascript file are as you recommended and I
think are working.

So it comes down to the chunkslist.class.php file, I have looked at
the database as I am trying different options and its not changing at
all, either good
or bad (ie corrupting) with the following code:

public function Process($chunkTitle, $chunkContent, $chunksList,

                                case 'recreateList':
                                        $newOrder = explode('_', $order);
                                        for ($i=0; $i < count($newOrder); $i++)
                                                $newOrder[$i] = 
                                                $result = 
$this->mysqlConnection->query('UPDATE chunks SET
order_no="' . $i . '" WHERE id="' . $newOrder[$i] . '"');
                                        $recreatedList = 
                                        return $recreatedList;

I have tried several different versions of this, the one you see is
the one that worked previously before I added the other text, it is
also very similar to the tutorial.

Any further help would be greatly appreciated, I can email the files
if its easier to see that way and you have the time.


On Feb 23, 1:55 pm, Walter Lee Davis <> wrote:
> sorry, this part should have been
> var foo = Sortable.create('chunksList',{}) //no need to tell it  
> tag:li -- it's the default
> Walter
> On Feb 23, 2009, at 8:33 AM, Walter Lee Davis wrote:
> > var foo = Sortable.serialize('chunksList',{}) //no need to tell it
> > tag:li -- it's the default
You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to