function updateOrder(node) { try { var a = jQuery('#THELIST').sortable("toArray"); var TLparams=""; for (var i=0; i<a.length; i++) { TLparams+="&THELIST[]="+a[i]; } var opt = { type: 'post', data: '<SUB HIDDENPARMS>&page=&category=&action=reorder&xrand=' + (new Date().valueOf()) + TLparams, // old way (before toArray) requires THELIST_ prefix on all ids, see javascript commented below // needs expression with ? so it is non-greedy. Otherwise dash/underscores cause problems // (new Date().valueOf()) + '&'+ jQuery('#THELIST').sortable("serialize", { expression: /(.+?)[-=_](.*)/ }), success: function(t) { if (t.length > 5) { try { // ignore the response... //alert(t); } catch (e) { // Occurs when bug has been closed, user no longer sees that bug // and another user exits that bug... alert("Error: " + e.name + " " + e.message); } } else { alert("t:"+t); } }, error: function(xhr, error) { log('mainMenuAjaxLoop onFailure:'+ xhr+" - " +error); if (DOLOOP==true) { setTimeout(mainMenuAjaxLoop,REFRESHTIME*5); } }, exception: function(transport, ex) { log('mainMenuAjaxLoop Trouble with:'+ transport.url); log('onException: ' + ex.message); } } jQuery.ajax('',opt); } catch (e) { // not going to happen... alert("Exception: " + e.name + " " + e.message); } } try { if (jQuery('#THELIST')!=undefined && jQuery('#THELIST').get(0)!=undefined ) { // prefix all tr ids with foo_ as serializable requires set_number as value var trList = jQuery('#THELIST').get(0).getElementsByTagName('TR'); var trnodes = jQuery.makeArray(trList); //this is only needed if we go back to using serialize( //jQuery.each(trnodes, function(index,node) { // node.id = "THELIST_" + node.id; // }); // change cursor for each name of items jQuery("#THELIST SPAN").each( function(index, node){ if (node.className == "handle") { node.style.cursor = "move"; } }); jQuery('#THELIST').sortable({ update: updateOrder }); } } catch (e) { // not going to happen... alert("Exception: " + e.name + " " + e.message); }