Parcourir la source

Merge branch 'refs/heads/7.x-1.9-order_tracklist' into 7.x-1.9

bachy il y a 13 ans
Parent
commit
461c93d48a
1 fichiers modifiés avec 7 ajouts et 4 suppressions
  1. 7 4
      term_reference_tree.js

+ 7 - 4
term_reference_tree.js

@@ -32,8 +32,8 @@
 					if(tracklist_is_orderable){
 						track_list_container.sortable({
 							update: function(event, ui) {
-								console.log('sort update : event', event);
-								console.log('sort update : ui', ui);
+								// console.log('sort update : event', event);
+								// console.log('sort update : ui', ui);
 
 								$.each(event.target.children, function(index, val) {
 									var $item = $(val),
@@ -177,7 +177,7 @@
    * @param control_type Control type - 'checkbox' or 'radio'.
    */
   function addItemToTrackList(track_list_container, item_text, control_id, control_type, delta) {
-		console.log('addItemToTrackList');
+		// console.log('addItemToTrackList');
     var new_item = $('<li class="track-item" delta="'+ delta +'"><div class="term-reference-tree-button-move"></div>' + item_text + '<div class="term-reference-tree-button-delete"></div></li>');
     new_item.data('control_id', control_id);
     
@@ -261,7 +261,10 @@
 		      	track_list_container.append(new_item);
 		    
 				}
-
+				
+				$hiddenInput = $('#'+control_id).parent('.form-item').next('input[type=hidden]');
+				$hiddenInput.val(new_item.index());
+				
 				track_list_container.sortable('refresh');
 			}
 		}