[jQuery] sortable with dynamic content

[jQuery] sortable with dynamic content


Hi,
I have a problem using the sortable function.
When I add some new portlet, they don't become dragable or if they do
I can drag them onto another section and after they lost their
dragable functionnality.
I really need help on this topic.
Regards,
Stan
Here's the code that I use.
(it comes from this url http://host.sonspring.com/portlets/)
$(document).ready(
    function()
    {
        $('div.portletWrapper').Sortable(
            {
                accept: 'portlet',
                helperclass: 'sort_placeholder',
                opacity: 0.7,
                tolerance: 'intersect',
                activeclass :     'sortableactive',
                hoverclass :     'sortablehover',
                handle: 'div.portlet_topper',
                onChange : function(ser)
                {
                },
            }
        );
function AddWidget()
{
idwidget+=1;
var wid="<div class=\"portlet\" id=\"wid"+idwidget+"\"><div class=
\"portlet_topper\">X. <a href=\"#\" class=\"toggle\">Blabla</a></
div><div class=\"portlet_content\">fqdfqdfqsd<br />fdsqfdf</div></
div>";
$
('#sort1').append(wid).SortableAddItem(document.getElementById('wid'+idwidget));
$('div.groupWrapper').sortableRefresh();
}