Success! Looks like we've fixed this one. According to our records the fix was applied for DSGNR-1419 in a recent build.
  1. #1
    Sencha User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    jimrising is on a distinguished road

      0  

    Default 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

  2. #2
    Sencha User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    jimrising is on a distinguished road

      0  

    Default 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...

  3. #3
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,413
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    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

  4. #4
    Sencha User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    jimrising is on a distinguished road

      0  

    Default 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.

  5. #5
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,413
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Put the first line as
    Code:
    var newValue = eOpts;
    When we release the fixed signature you'll just delete that first line as newValue will be the appropriate argument.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  6. #6
    Sencha User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    jimrising is on a distinguished road

      0  

    Default 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?

  7. #7
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,413
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Sorry.

    var newValue = options;
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  8. #8
    Sencha User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    jimrising is on a distinguished road

      0  

    Default 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] }
    I'm really just hoping to get the newly set value of the slider control. is this found somewhere in this
    object? I've looked through it but didn't find any reference to newValue.

  9. #9
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,413
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    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

  10. #10
    Sencha User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    jimrising is on a distinguished road

      0  

    Default console.log(slider._component._value);

    console.log(slider._component._value);


    I think I found it here:

    console.log(slider._component._value);

Thread Participants: 1

Tags for this Thread