Clarification:
I am trying to make the portlets sortable, but trying to connect them with any columns that are siblings
I would like my web-application to automatically apply the jquery ui
sortable
interaction to all divs with the class .column
.
There are two little tricks that I need in this solution, no its not as simple as $(".column").sortable()
...
- I need the columns to
connectWith
any other columns that are siblings - I would like the solution to apply to any
.column
elements that are dynamically generated, i've been looking for something similar to my new favorite toy,.live()
, to no avail... although a custom event to detect a.column
element creation might work, not sure how to do that though.
EX:
markup
<div id="container1" class="column-container">
<div class="column">
<div class="portlet"></div>
<div class="portlet"></div>
<div class="portlet"></div>
</div>
<div class="column">
<div class="portlet"></div>
<div class="portlet"></div>
<div class="portlet"></div>
</div>
<div class="column">
<div class="portlet"></div>
<div class="portlet"></div>
<div class="portlet"></div>
</div>
</div>
javascript
$(document).ready(function(){
$columns = $(".column");
$columns.sortable({
connectWith: $columns.parent().find('.column') //this untested, but you get the idea... i'll write back with the results of this, might be some good direction
});
});
I would like the columns in container1
to be sortable with other columns in container1
, but not container2
. Also those in container2
w/ container2
but not container1
.