The toArray method only returns one serialization (for the first element in
the set) just like

$("div").attr("id") // returns $("div")[0].id

or

$("p").width() // same as $("p").eq(0).width()

This will be true of any getter method (as far as I'm aware) in jQuery and
jQuery UI. Since you have three sortables, you'll need to call
.sortable("toArray") or .sortable("serialize") on each one. For example
(untested):

$(".column").each(function() {
  alert($(this).sortable("toArray"));
});

- Richard

On Tue, Feb 10, 2009 at 8:16 PM, chris <[email protected]> wrote:

>
> Using the code provided on this page:
>
> http://ui.jquery.com/demos/sortable/#portlets
>
> How can you use sortable('serialize') or sortable('toArray') to get
> the order of the DIVs so they can be saved?
>
> I assigned each portlet its own unique ID:
>
> <div class="column" id="col1">
>        <div class="portlet" id="box_feeds">
>                <div class="portlet-header">Feeds</div>
>                <div class="portlet-content">Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit</div>
>        </div>
>
>        <div class="portlet" id="box_news">
>                <div class="portlet-header">News</div>
>                <div class="portlet-content">Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit</div>
>        </div>
> </div>
> <div class="column" id="col2">
>        <div class="portlet" id="box_shopping">
>                <div class="portlet-header">Shopping</div>
>                <div class="portlet-content">Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit</div>
>        </div>
> </div>
> <div class="column" id="col3">
>        <div class="portlet" id="box_links">
>                <div class="portlet-header">Links</div>
>                <div class="portlet-content">Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit</div>
>        </div>
>
>        <div class="portlet" id="box_images">
>                <div class="portlet-header">Images</div>
>                <div class="portlet-content">Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit</div>
>        </div>
> </div>
>
> When I try, all I get is a list from the first column only, even
> though all DIVs can be moved between all 3 columns.
>
>                $(".column").sortable({
>                        connectWith: ['.column'],
>                        stop: function() {
>                                alert($(".column").sortable("toArray"));
>                        }
>                });
>
> Help! This driving me MAD! :)
>
> TIA,
> Chris
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" 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/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to