Explorar el Código

js new items bug fixed

Signed-off-by: bachy <git@g-u-i.net>
bachy hace 13 años
padre
commit
47348748c4
Se han modificado 1 ficheros con 7 adiciones y 4 borrados
  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');
 			}
 		}