My web page (developed in php and MySQL)is having a table with each
table cell having a list of related information as list item.
First, the list is performing well when page is loaded (i.e. multiple
lists are created and list items can be dragged and dropped on each
other lists).
Whenever double click on specific cell, it''ll invoked ajax function
(created by myself) to refresh the list with latest list item in that
specific cell(i only forming list item string and update list using
ul_name.innerHTML since i nv delete the list itself).
However, after refreshing the list, this list become "undraggable"
again
and if try to drag list item of other list, it''ll give an error namely
"unspecified error".
I need some detail guide on what to do after i refresh the list using
ajax.
The following is my partial code:
/*this is the only line of code added to make the list item drag and
drop working when page first loaded, $dropOnListName contains name of
all the lists that can be droppable by the list items*/
Sortable.create("<?php echo $cellListId;
?>",{dropOnEmpty:true,containment:[<?php echo $dropOnListName;
?>],constraint:false});
//this is the callback function of ajax request
function processRequest() {
var results, listItemString='' '', listItemColor;
if (ajaxReq.readyState == 4) {
if (ajaxReq.status == 200) {
results = ajaxReq.responseText.split("=");
for(var h=0; h<results.length; h+=2){
listItemColor = "Green";
lessonType = lessonType.toUpperCase();
switch(lessonType){
case ''LEC'': listItemColor = ''Red'';
break;
case ''TUT'': listItemColor = ''Blue'';
break;
case ''LAB'': listItemColor = ''Brown'';
break;
} //end-switch-case
listItemString += ''<li id="test''+h+''"
style="color:''
+listItemColor+'';">''+results[h+1]+''</li>'';
} //end-for
ajaxTarget.innerHTML = listItemString;
}else{
alert("An error has occurred: "+ajaxReq.statusText);
} //end-if-else-status
} //end-if-readyState
}//end-processRequest()
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---