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,551
    Answers
    3931
    Vote Rating
    1271
      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! Checkout the CODE tag!

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

  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
  •