Results 1 to 3 of 3

Thread: Slider event when setValues or setRecord is used?

  1. #1
    Sencha User tomalex0's Avatar
    Join Date
    Apr 2009
    Location
    San Jose, CA
    Posts
    589
    Answers
    1
    Vote Rating
    20
      0  

    Default Answered: Slider event when setValues or setRecord is used?

    Is there any event fired when slider value is changed using setValues or setRecord

    change, updatedata events were not firing?
    Sencha Touch Demos

    IosToggleField Forum - Github
    Form Validation
    Forum - Github
    Iphone Settings Menu
    Forum
    Sqlite Storage & Login Manifest
    Forum
    KitchenSink MVC
    Forum - Github
    SqliteProxy-v1 Forum - Github
    SqliteProxy-v2
    Forum - Github
    Arshaw Fullcalendar Forum - Github






  2. No but with this override you can get the change event working when you do a setValue on the field:

    Code:
    Ext.define('Override.slider.Slider', {
        override : 'Ext.slider.Slider',
    
        updateValue : function(newValue, oldValue) {
            this.callOverridden([newValue, oldValue]);
    
            var changed = false,
                v       = 0,
                vNum    = newValue.length;
    
            if (oldValue) {
                for (; v < vNum; v++) {
                    if (newValue[v] !== oldValue[v]) {
                        changed = true;
                        break;
                    }
                }
            }
    
            if (changed) {
                this.fireEvent('change', this, newValue, oldValue);
            }
        }
    });
    You would have to try the setValues and setRecord on the form but it should still work.

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,323
    Answers
    3884
    Vote Rating
    1294
      0  

    Default

    No but with this override you can get the change event working when you do a setValue on the field:

    Code:
    Ext.define('Override.slider.Slider', {
        override : 'Ext.slider.Slider',
    
        updateValue : function(newValue, oldValue) {
            this.callOverridden([newValue, oldValue]);
    
            var changed = false,
                v       = 0,
                vNum    = newValue.length;
    
            if (oldValue) {
                for (; v < vNum; v++) {
                    if (newValue[v] !== oldValue[v]) {
                        changed = true;
                        break;
                    }
                }
            }
    
            if (changed) {
                this.fireEvent('change', this, newValue, oldValue);
            }
        }
    });
    You would have to try the setValues and setRecord on the form but it should still work.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User tomalex0's Avatar
    Join Date
    Apr 2009
    Location
    San Jose, CA
    Posts
    589
    Answers
    1
    Vote Rating
    20
      0  

    Default

    Hi Mitchel,

    Thanks for the help, works fine. I was trying to figure out how to override and here it is .
    It will be nice to have document on extending a component.
    Sencha Touch Demos

    IosToggleField Forum - Github
    Form Validation
    Forum - Github
    Iphone Settings Menu
    Forum
    Sqlite Storage & Login Manifest
    Forum
    KitchenSink MVC
    Forum - Github
    SqliteProxy-v1 Forum - Github
    SqliteProxy-v2
    Forum - Github
    Arshaw Fullcalendar Forum - Github






Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •