public/javascripts/WireIt/build/wireit-inputex-editor-grouping.js
function (config) {
			
			var choice, position, that;
			
			// allow config not to be an object, just a value -> convert it in a standard config object
			if (!lang.isObject(config)) {
				config = { value: config };
			}
			
			choice = {
				value: config.value,
				label: lang.isString(config.label) ? config.label : "" + config.value,
				visible: true
			};
			
			// Create DOM <option> node
			choice.node = this.createChoiceNode(choice);
			
			// Get choice's position
			//   -> don't pass config.value to getChoicePosition !!!
			//     (we search position of existing choice, whereas config.value is a property of new choice to be created...)
			position = this.getChoicePosition({ position: config.position, label: config.before || config.after });
			
			if (position === -1) { //  (default is at the end)
				position = this.choicesList.length;
				
			} else if (lang.isString(config.after)) {
				// +1 to insert "after" position (not "at" position)
				position += 1;
			}
			
			
			// Insert choice in list at position
			this.choicesList.splice(position, 0, choice);
			
			// Append <option> node in DOM
			this.appendChoiceNode(choice.node, position);
			
			// Select new choice
			if (!!config.selected) {
				
				// setTimeout for IE6 (let time to create dom option)
				that = this;
				setTimeout(function () {
					that.setValue(choice.value);
				}, 0);
				
			}
			
			// Return generated choice
			return choice;
			
		}
function (config) {
			
			var choice, position, that;
			
			// allow config not to be an object, just a value -> convert it in a standard config object
			if (!lang.isObject(config)) {
				config = { value: config };
			}
			
			choice = {
				value: config.value,
				label: lang.isString(config.label) ? config.label : "" + config.value,
				visible: true
			};
			
			// Create DOM <option> node
			choice.node = this.createChoiceNode(choice);
			
			// Get choice's position
			//   -> don't pass config.value to getChoicePosition !!!
			//     (we search position of existing choice, whereas config.value is a property of new choice to be created...)
			position = this.getChoicePosition({ position: config.position, label: config.before || config.after });
			
			if (position === -1) { //  (default is at the end)
				position = this.choicesList.length;
				
			} else if (lang.isString(config.after)) {
				// +1 to insert "after" position (not "at" position)
				position += 1;
			}
			
			
			// Insert choice in list at position
			this.choicesList.splice(position, 0, choice);
			
			// Append <option> node in DOM
			this.appendChoiceNode(choice.node, position);
			
			// Select new choice
			if (!!config.selected) {
				
				// setTimeout for IE6 (let time to create dom option)
				that = this;
				setTimeout(function () {
					that.setValue(choice.value);
				}, 0);
				
			}
			
			// Return generated choice
			return choice;
			
		}
function ( config ) { var choice , position , that ; // allow config not to be an object, just a value -> convert it in a standard config object if ( ! lang . isObject ( config ) ) { config = { value : config } ; } choice = { value : config . value , label : lang . isString ( config . label ) ? config . label : "" + config . value , visible : true } ; // Create DOM <option> node choice . node = this . createChoiceNode ( choice ) ; // Get choice's position //   -> don't pass config.value to getChoicePosition !!! //     (we search position of existing choice, whereas config.value is a property of new choice to be created...) position = this . getChoicePosition ( { position : config . position , label : config . before || config . after } ) ; if ( position === - 1 ) { //  (default is at the end) position = this . choicesList . length ; } else if ( lang . isString ( config . after ) ) { // +1 to insert "after" position (not "at" position) position += 1 ; } // Insert choice in list at position this . choicesList . splice ( position , 0 , choice ) ; // Append <option> node in DOM this . appendChoiceNode ( choice . node , position ) ; // Select new choice if ( ! ! config . selected ) { // setTimeout for IE6 (let time to create dom option) that = this ; setTimeout ( function ( ) { that . setValue ( choice . value ) ; } , 0 ) ; } // Return generated choice return choice ; }
Add a choice
@param {Object} config An object describing the choice to add (e.g. { value: 'second' [, label: 'Second' [, position: 1 || after: 'First' || before: 'Third']] })
Add a choice