I have the answer of my question thanks to : 
http://www.zenofshen.com/2008/01/08/scriptaculous-ajax-sortable-lists-tutorial/

The id of the elements have to be in the form /string_identifier/, where 
/identifier/ is a unique number, for Sortable.serialize to work.
By calling the id of my list like that :
          <li id="item_2">Item 2</li>
    <li id="item_1">Item 1</li>
    <li id="item_3">Item 3</li>

I get : sortable_list[]=2&sortable_list[]=1&sortable_list[]=3
Maybe that will help someone...


Pierre MARCOURT a écrit :
> Hi,
>
> I am using the $ajax->sortable function to change the order of a list 
> (3 items).
> Then I want to save the order in a database but I have a problem.
> When I use Sortable.serialize to send the data to my controller, my 
> array is empty...
>
> Here is the code I use in my view :
>         <?php echo $ajax->sortable("sortable_list", array('handle' => 
> 'title_rbox', 'constraint' => 'false', 'onChange' => '
>                 function() { 
>                     new Ajax.Request("/users/ajaxorderlist", { 
>                     method: "post", 
>                     parameters: { data: 
> Sortable.serialize("sortable_list") } 
>                     })
>                 }
>                 '));
>         ?>
>
> The POST['data'] I receive in my controller is :
> sortable_list[]=&sortable_list[]=&sortable_list[]=
>
> I don't understand why I don't have the id of the different item, like 
> that : 
> sortable_list[]=item_2&sortable_list[]=item_1&sortable_list[]=item_3
>
> I did not find out the answer of my question on Google, so if someone 
> has an idea ?
>
> Thanks.
>
> >


-- 
Pierre

[EMAIL PROTECTED]
_____________________

CableOrganizer.com
5610 NW 12th Ave, suite 214
Ft.Lauderdale, FL 33309
Phone: 954-861-6310


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to