-
17 Feb 2012 7:46 PM #1
Touch: slider change event signature is incorrect
Touch: slider change event signature is incorrect
I've been trying to get the value of a slider on change using sencha touch 2.0:
Ext.define('MyApp.view.MySliderField', {
extend: 'MyApp.view.ui.MySliderField',
alias: 'widget.mysliderfield',
initialize: function() {
var me = this;
me.callParent(arguments);
},
onSliderfieldChange: function(slider, value, options) {
console.log(value);
}
});
And all it returns to the console is Ext.apply.create.Class ... how do I get the value of the slider on change?Last edited by jimrising; 17 Feb 2012 at 8:11 PM. Reason: to show version i'm using
-
17 Feb 2012 8:10 PM #2
Ext JS 4.0.x works fine?
Ext JS 4.0.x works fine?
the implementation is a bit different:
Ext.define('MyApp.view.MyPanel', {
extend: 'MyApp.view.ui.MyPanel',
initComponent: function() {
var me = this;
me.callParent(arguments);
},
onSliderChange: function(slider, newValue, thumb, options) {
console.log(newValue);
}
});
but this is working fine... just does not seem to work with the sencha touch 2.0 implementation...
-
17 Feb 2012 8:11 PM #3
Moving this to the bug forum. The signature of the slider change event is (slider, thumb, newValue, oldValue, eOpts).
http://docs.sencha.com/touch/2-0/#!/...r-event-change
The designer is generating the signature as (slider, value, eOpts). This was probably a change in between betas of Sencha Touch that we missed.Aaron Conran
@aconran
Sencha Architect Development Team
-
17 Feb 2012 8:19 PM #4
any workaround in the meantime?
any workaround in the meantime?
thanks for answering so quickly!

is there anything that i can do to make this work while it's being fixed on your side?
Last edited by jimrising; 17 Feb 2012 at 8:20 PM. Reason: politeness fail.
-
18 Feb 2012 9:39 AM #5
Put the first line as
When we release the fixed signature you'll just delete that first line as newValue will be the appropriate argument.Code:var newValue = eOpts;
Aaron Conran
@aconran
Sencha Architect Development Team
-
20 Feb 2012 8:47 AM #6
eOpts is not defined?
eOpts is not defined?
not sure where you wanted me to put that line... so I just put it here:
onSliderfieldChange: function(slider, value, options) {
var newValue = eOpts;
console.log(newValue);
}
but this didn't make a lot of sense to me because eOpts isn't being passed in at all?
-
20 Feb 2012 8:56 AM #7
Sorry.
var newValue = options;Aaron Conran
@aconran
Sencha Architect Development Team
-
20 Feb 2012 9:06 AM #8
options returns object
options returns object
ok... so the way that 'newValue' works with ext4 ... it returns the new value of the slider.
var newValue = options;
console.log(newValue);
returns the object:
Object
- event: "change"
- fn: "onSliderfieldChange"
- __proto__: Object
- __defineGetter__: function __defineGetter__() { [native code] }
- __defineSetter__: function __defineSetter__() { [native code] }
- __lookupGetter__: function __lookupGetter__() { [native code] }
- __lookupSetter__: function __lookupSetter__() { [native code] }
- constructor: function Object() { [native code] }
- hasOwnProperty: function hasOwnProperty() { [native code] }
- isPrototypeOf: function isPrototypeOf() { [native code] }
- propertyIsEnumerable: function propertyIsEnumerable() { [native code] }
- toLocaleString: function toLocaleString() { [native code] }
- toString: function toString() { [native code] }
- valueOf: function valueOf() { [native code] }
is this found somewhere in this
object? I've looked through it but didn't find any reference to newValue.
-
20 Feb 2012 9:13 AM #9
The documentation may be incorrect. We will verify this.
Take a look at the arguments variable (if you're not familiar with the arguments object passed to each function in javascript, its a pseudo-array of all the arguments passed to a function, google arguments javascript).Aaron Conran
@aconran
Sencha Architect Development Team
-
20 Feb 2012 10:23 AM #10
console.log(slider._component._value);
console.log(slider._component._value);
I think I found it here:
console.log(slider._component._value);
Success! Looks like we've fixed this one. According to our records the fix was applied for
DSGNR-1419
in
Architect 2.0.


Reply With Quote