I am attempting to build a page, however using some sample code the
page have drag and drop functionality.
After using a simple jqeury statement to add to this form, every thing working (drag and drop)properly.
Now my actual requirement is
I need to generate the controls dynamically. Whne I generated all controls from server side and put all the generated controls HTML snipet in <div id="sort1" class="groupWrapper"> its working fine but when I try to put same HTML snippet in the same DIV using JavaScript drag and drop functionality not working;
Is there another way of doing this, or am I doing something wrong.
Below is the code I am using.
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
html xmlns="http://www.w3.org/1999/xhtml">document.getElementById(
'sort1').innerHTML = str + str1 + str2;}
</script> <style type="text/css" media="all">img
{
border: none;}
body{
background: #fff; height: 100%; font-family: Arial, Helvetica, sans-serif; font-size: 11px;}
.groupWrapper{
width: 32%; float: left; margin-right: 1%; min-height: 400px;}
.serializer{
clear: both;}
.groupItem{
margin-bottom: 20px;}
.groupItem .itemHeader{
line-height: 28px; background-color: #DAFF9F; border-top: 2px solid #B5EF59; color: #000; padding: 0 10px; cursor: move; font-weight: bold; font-size: 16px; height: 28px; position: relative;}
.groupItem .itemHeader a{
position: absolute; right: 10px; top: 0px; font-weight: normal; font-size: 11px; text-decoration: none;}
.sortHelper{
border: 3px dashed #666; width: auto !important;}
.groupWrapper p{
height: 1px; overflow: hidden; margin: 0; padding: 0;}
</style></
head></
head><
body onload="hello();"><
div id="sort1" class="groupWrapper"> </div> <script type="text/javascript">$(document).ready(
function() {$(
'a.closeEl').bind('click', toggleContent);$(
'div.groupWrapper').Sortable({
accept:
'groupItem',helperclass:
'sortHelper',activeclass:
'sortableactive',hoverclass:
'sortablehover',handle:
'div.itemHeader',tolerance:
'pointer',onChange:
function(ser) {},
onStart:
function() {$.iAutoscroller.start(
this, document.getElementsByTagName('body'));},
onStop:
function() {$.iAutoscroller.stop();
}
}
);
}
);
var toggleContent = function(e) { var targetContent = $('div.itemContent', this.parentNode.parentNode); if (targetContent.css('display') == 'none') {targetContent.slideDown(300);
$(
this).html('[-]');}
else {targetContent.slideUp(300);
$(
this).html('[+]');}
return false;};
function serialize(s) {serial = $.SortSerialize(s);
alert(serial.hash);
};
</script> <div class="serializer"> <a href="#" onclick="serialize(); return false;">serialize all lists</a> <a href="#" onclick="serialize('sort1'); return false;">serialize list 1</a> <a href="#" onclick="serialize('sort2'); return false;">serialize list 2
</a> <a href="#" onclick="serialize('sort3'); return false;">serializelist 3
</a> <a href="#" onclick="serialize(['sort1', 'sort3']); return false;">serializelists 2 and 3
</a> </div> <script language="JavaScript" src="sort_files/track.js" type="text/javascript"></script></
body></
html>