Use the following code to create a basic inputEx VectorField.
1 | var field = new inputEx.VectorField({parentEl: 'container1', value: [-10.4,13*2]}); |
2 | |
3 | var el = YAHOO.util.Dom.get('container1'); |
4 | |
5 | var button1 = inputEx.cn('button', null, null, "SetValue"); |
6 | el.appendChild(button1); |
7 | YAHOO.util.Event.addListener(button1, "click" ,function() { |
8 | field.setValue([-42.42,12.603]); |
9 | }); |
10 | |
11 | var logDiv = inputEx.cn('div', null, null, "Log :"); |
12 | el.appendChild(logDiv); |
13 | field.updatedEvt.subscribe(function(e,params) { |
14 | var value = params[0]; |
15 | logDiv.innerHTML += "Updated at "+(new Date())+" with value "+value; |
16 | logDiv.appendChild(inputEx.cn('br')); |
17 | }); |
view plain | print | ? |
VectorField inherits CombineField, so you can change the separators :
1 | new inputEx.VectorField({ |
2 | parentEl: 'container2', |
3 | value: [-10.4,13*2], |
4 | separators: ["x:",", y:", null] |
5 | }); |
view plain | print | ? |
Set the dimension option :
1 | new inputEx.VectorField({ |
2 | parentEl: 'container3', |
3 | value: [-1, 0, 1], |
4 | dimension: 3, |
5 | separators: ["x:",", y:", ", z: ", null] |
6 | }); |
view plain | print | ? |