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:
//php
foreach($_POST['order'] as $k=>$v){
if($item = ActiveRecord::FindById('items',$v){
$v->position = $k+1;
$v->save();
would be implemented. I have a code file which my AJAX requests are
passed through, which contains the code:
<?php
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,
$action);
?>
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,
$action)
{
switch($action)
{
case 'recreateList':
$newOrder = explode('_', $order);
for ($i=0; $i < count($newOrder); $i++)
{
$newOrder[$i] =
$this->mysqlConnection->real_escape_string
($newOrder[$i]);
$result =
$this->mysqlConnection->query('UPDATE chunks SET
order_no="' . $i . '" WHERE id="' . $newOrder[$i] . '"');
}
$recreatedList =
$this->BuildChunksList();
return $recreatedList;
break;
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.
Regards
On Feb 23, 1:55 pm, Walter Lee Davis <[email protected]> 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 & script.aculo.us" 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/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---