Issue with sortables drag and drop
Hi,
I wrote 2 sortables (<UL>s) with the same code and they have only ul1
has an element but ul2 is empty. I kept moving the <LI> element from
ul1 to ul2 to ul1 ... at a moderate pace and at some point the element
doesn't move. It just gives this error :
[Exception... "Could not convert JavaScript argument" nsresult:
"0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame ::
http://phpdev.talkpoint.com/qps/libs/jquery/jquery.js :: anonymous ::
line 23" data: no]
[Break on this error] jQuery.swap(elem,props,getWH);return
Math.max(0,val);}return jQuery.curCSS(elem,...
Here's the code i use to initiate them both :
By the way, both the UL elements have classes flora and qrow_group
hopefully this will keep the code indented ..
$('ul.qrow_group').sortable({
connectWith : ['.flora'],
tolerance : 'pointer',
items : '.qrow_item',
placeholder : 'qrow_group_helper',
zIndex : 100,
revert : true,
update : function(e, ui) {
var id1 = this.id.substring(13);
var pollId = $('#poll-'+id1+'-id').val();
var pollId2 = '';
var children = $(this).children();
if (ui.sender) { // Question was sent from another poll
var draggedEl = ui.item[0].id;
pollId2 = $('#poll-'+draggedEl.substring(13)+'-id').val();
// Put the question back to the source if target has more than <X>
questions
if ((10 <= children.length)
|| ((2 <= children.length) && (id1 != 'event_pool_list')
&& (undefined != $
(children[0]).find('.rating_scale_useless_class')[0]
|| undefined != $(children[1]).find('.rating_scale_useless_class')
[0]))
|| ((2 <= children.length) && (id1 != 'event_pool_list')
&& (undefined != $
('#'+draggedEl).find('.rating_scale_useless_class')[0]))
) {
$('#'+ui.sender[0].id).append($('#'+draggedEl)[0]);
return false;
}
}
// code truncated ...
$.post('index.php', {
task: 'order_questions',
poll_id: (null == pollId)? '': pollId,
poll_id2: (null == pollId2)? '': pollId2,
questions: ids
},
function(data) {
//alert(data);
// Attach the update timer after the request is complete
timerObj = setInterval('updater()', $('#ajax_timer').val());
if ($.browser.msie) {
window.location.reload(true);
}
}
);
return;
}
});
Am I doing anything wrong here ? If so, can you guys please point mein
the right direction. It could be a bug but I have a feeling it's me.
Thanks in advance
Moazzam