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
connectWithany other columns that are siblings - I would like the solution to apply to any
.columnelements 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.columnelement 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.
From what I understand this is easier than you are making it.
For the sortable columns within a container, from your markup, the jquery activation would be:
The selector you currently have on your sortable would actually make the portlets sortable.
As for the live events, refer to this earlier question:
live drag and drop
EDIT:
After your comment, the selector would be:
EDIT 2:
Since it is still not working here is the full example: