Sortables Anon [RAW] [fav] [!]

  1. function startOrdering(album_id) {
  2.  
  3.  
  4. mySortableTable = new Sortables($('songs_' + album_id),{
  5.  
  6. onStart: function(el) {
  7. el.setStyle('background-color','#333333');
  8.  
  9. scrollStart(el);
  10. },
  11.  
  12. onComplete: function(el) {
  13. el.setStyle('background-color','');
  14.  
  15. var order = mySortableTable.serialize(0, function(element, index){
  16. return 'item=' + index;
  17. }).join('&');
  18.  
  19. alert(order);
  20.  
  21. var url = '/index.php?view=songs&task=saveOrder';
  22.  
  23. var ajaxObj = new Ajax (url, {
  24. method: "post",
  25. data: { 'order' : order, 'old_order' : $('oldSongOrder_' + album_id).value, 'album_id' : album_id }
  26.  
  27. });
  28.  
  29. ajaxObj.addEvent('onComplete', function (data) {
  30. var json = Json.evaluate(data);
  31. $('oldSongOrder_' + album_id).value = json.neworder;
  32.  
  33. });
  34.  
  35.  
  36. ajaxObj.request();
  37. }
  38.  
  39. });
  40. }
  41.  
  42. function finishOrdering() {
  43. mySortableTable.detach();
  44. }
  45.  

Posted on Thursday, Apr 28 6:00:44 2011 EST