inputEx - VectorField Usage

Basic VectorField creation

Use the following code to create a basic inputEx VectorField.

			var field = new Y.inputEx.VectorField({parentEl: 'container1', value: [-10.4,13*2]});

			var el = Y.one('#container1');

			var button1 = inputEx.cn('button', null, null, "SetValue");
			el.appendChild(button1);
			Y.one(button1).on('click' ,function() {
			   field.setValue([-42.42,12.603]);
			});

			var logDiv = inputEx.cn('div', null, null, "Log :");
			el.appendChild(logDiv);
			field.on('updated', function(value) {
				logDiv.innerHTML += "Updated at "+(new Date())+" with value "+value;
				logDiv.appendChild(inputEx.cn('br'));
			});
		

VectorField with separators

VectorField inherits CombineField, so you can change the separators :

			new Y.inputEx.VectorField({
				parentEl: 'container2', 
				value: [-10.4,13*2],
				separators: ["x:",", y:", null]
			});
		

VectorField dimension

Set the dimension option :

			new Y.inputEx.VectorField({
				parentEl: 'container3', 
				value: [-1, 0, 1],
				dimension: 3,
				separators: ["x:",", y:", ", z: ", null]
			});