public/javascripts/inputex/build/inputex.js
function(e) {
	   var childElement = Event.getTarget(e).parentNode;
	   
	   var previousChildNode = null;
	   var nodeIndex = -1;
	   for(var i = 1 ; i < childElement.parentNode.childNodes.length ; i++) {
	      var el=childElement.parentNode.childNodes[i];
	      if(el == childElement) {
	         previousChildNode = childElement.parentNode.childNodes[i-1];
	         nodeIndex = i;
	         break;
	      }
	   }
	   
	   if(previousChildNode) {
	      // Remove the line
	      var removedEl = this.childContainer.removeChild(childElement);
	      
	      // Adds it before the previousChildNode
	      var insertedEl = this.childContainer.insertBefore(removedEl, previousChildNode);
	      
	      // Swap this.subFields elements (i,i-1)
	      var temp = this.subFields[nodeIndex];
	      this.subFields[nodeIndex] = this.subFields[nodeIndex-1];
	      this.subFields[nodeIndex-1] = temp;
	
			// Note: not very efficient, we could just swap the names
			this.resetAllNames();
	
	      // Color Animation
	      if(this.arrowAnim) {
	         this.arrowAnim.stop(true);
	      }
	      this.arrowAnim = new YAHOO.util.ColorAnim(insertedEl, {backgroundColor: this.arrowAnimColors}, 0.4);
	      this.arrowAnim.onComplete.subscribe(function() { Dom.setStyle(insertedEl, 'background-color', ''); });
	      this.arrowAnim.animate();
	      
	      // Fire updated !
	      this.fireUpdatedEvt();
	   }
	}
function(e) {
	   var childElement = Event.getTarget(e).parentNode;
	   
	   var previousChildNode = null;
	   var nodeIndex = -1;
	   for(var i = 1 ; i < childElement.parentNode.childNodes.length ; i++) {
	      var el=childElement.parentNode.childNodes[i];
	      if(el == childElement) {
	         previousChildNode = childElement.parentNode.childNodes[i-1];
	         nodeIndex = i;
	         break;
	      }
	   }
	   
	   if(previousChildNode) {
	      // Remove the line
	      var removedEl = this.childContainer.removeChild(childElement);
	      
	      // Adds it before the previousChildNode
	      var insertedEl = this.childContainer.insertBefore(removedEl, previousChildNode);
	      
	      // Swap this.subFields elements (i,i-1)
	      var temp = this.subFields[nodeIndex];
	      this.subFields[nodeIndex] = this.subFields[nodeIndex-1];
	      this.subFields[nodeIndex-1] = temp;
	
			// Note: not very efficient, we could just swap the names
			this.resetAllNames();
	
	      // Color Animation
	      if(this.arrowAnim) {
	         this.arrowAnim.stop(true);
	      }
	      this.arrowAnim = new YAHOO.util.ColorAnim(insertedEl, {backgroundColor: this.arrowAnimColors}, 0.4);
	      this.arrowAnim.onComplete.subscribe(function() { Dom.setStyle(insertedEl, 'background-color', ''); });
	      this.arrowAnim.animate();
	      
	      // Fire updated !
	      this.fireUpdatedEvt();
	   }
	}
function ( e ) { var childElement = Event . getTarget ( e ) . parentNode ; var previousChildNode = null ; var nodeIndex = - 1 ; for ( var i = 1 ; i < childElement . parentNode . childNodes . length ; i ++ ) { var el = childElement . parentNode . childNodes [ i ] ; if ( el == childElement ) { previousChildNode = childElement . parentNode . childNodes [ i - 1 ] ; nodeIndex = i ; break ; } } if ( previousChildNode ) { // Remove the line var removedEl = this . childContainer . removeChild ( childElement ) ; // Adds it before the previousChildNode var insertedEl = this . childContainer . insertBefore ( removedEl , previousChildNode ) ; // Swap this.subFields elements (i,i-1) var temp = this . subFields [ nodeIndex ] ; this . subFields [ nodeIndex ] = this . subFields [ nodeIndex - 1 ] ; this . subFields [ nodeIndex - 1 ] = temp ; // Note: not very efficient, we could just swap the names this . resetAllNames ( ) ; // Color Animation if ( this . arrowAnim ) { this . arrowAnim . stop ( true ) ; } this . arrowAnim = new YAHOO . util . ColorAnim ( insertedEl , { backgroundColor : this . arrowAnimColors } , 0.4 ) ; this . arrowAnim . onComplete . subscribe ( function ( ) { Dom . setStyle ( insertedEl , 'background-color' , '' ) ; } ) ; this . arrowAnim . animate ( ) ; // Fire updated ! this . fireUpdatedEvt ( ) ; } }
Switch a subField with its previous one
Called when the user clicked on the up arrow of a sortable list
@param {Event} e Original click event
Switch a subField with its previous one Called when the user clicked on the up arrow of a sortable list