我可以使用$(this).sortable("serialize");
. 当我将 portlet 从一列放置到另一列时,它会显示这两列中 portlet 的更新顺序。这是来自 column2 的更新顺序widget[]=xyz
,对于 column3 它是widget[]=pqr&widget[]=hij
所以,我的问题是如何知道返回的 2 数组列表属于哪些列?我可以返回每列的键值对,例如col3: widget[]=pqr&widget[]=hij
andcol2 : widget[]=xyz
吗?
我现在的代码是: -
$( ".column" ).sortable({
connectWith: ".column",
handle: ".portlet-header",
update : function(event, ui) {
var postData = $(this).sortable("serialize");
console.log(postData);
}
});
HTML
<div class="column" id="col1">
<div class="portlet" id="widget_abc">
<div class="portlet-header">Feeds</div>
<div class="portlet-content" >Lorem ipsum dolor sit amet, consectetuer adipiscing elit
</div>
</div>
<div class="portlet" id="widget_def">
<div class="portlet-header">News</div>
<div class="portlet-content" >Lorem ipsum dolor sit amet</div>
</div>
</div>
<div class="column" id="col2">
<div class="portlet" id="widget_hij">
<div class="portlet-header">Shopping</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer</div>
</div>
</div>
<div class="column" id="col3">
<div class="portlet" id="widget_xyz">
<div class="portlet-header">Links</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
<div class="portlet" id="widget_pqr">
<div class="portlet-header">Images</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</div>