Serialize jquery sort

I’ve been digging on this site for a long time and doing Internet searches, and I can’t find a good solution to my problem. I would like to be able to maintain the state of jquery portlets on a page. I would prefer not to have a “save state” button if I can avoid this.

Anyway, I just have jquery code copied from their portlet example:

$(function() {
    $(".column").sortable({
        connectWith: '.column'
    });

    $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
        .find(".portlet-header")
            .addClass("ui-widget-header ui-corner-all")
            .prepend('<span class="ui-icon ui-icon-minusthick"></span>')
            .end()
        .find(".portlet-content");

    $(".portlet-header .ui-icon").click(function() {
        $(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick");
        $(this).parents(".portlet:first").find(".portlet-content").toggle();
    });

    $(".column").disableSelection();
});

I have tried to add $(".column").serialize()and $(".column").sortable('serialize')the same as above, but instead used $(".portlet")... I've created a variable and set its value s serialize method, but does not return anything. What am I doing wrong?

Edit: Here is the code for the column with the portlet inside:

 <div class="column" id="column_1">

<div class="portlet" id="portlet_1">

<div class="portlet-header">Times</div>
&nbsp Longest:
<div class="portlet-content">

<ChartFXGauge:DigitalPanel ID="LongestTimePanel" runat="server" >
</ChartFXGauge:DigitalPanel>
<p>
<a href="LongestORTime.aspx">(BySurgeon)</a>
</p>
</div>
</div>
</div>
+3
3

:

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

.

+3

.toArray() sortable.

jquery:

ToArray

:     .sortable( "toArray" )

id .

<ul id="a_sortable"><br>
<li id="hello">Hello</li><br>
<li id="goodbye">Good bye</li><br>
</ul>

do

var result = $('#a_sortable').sortable('toArray');

[0] "" [1] " ".

, - ajax- change, .sortable('toArray'), .

+2

id?

docs

serialize , , id

0

Source: https://habr.com/ru/post/1752527/


All Articles