Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Location
    India
    Posts
    28
    Vote Rating
    2
    tanmayasahu is on a distinguished road

      0  

    Default Answered: Combobox Should have a option for don't fire the change Event when using setValue()

    Answered: Combobox Should have a option for don't fire the change Event when using setValue()


    Hi ExtJS Dev Team,
    I am facing a issue with combobox setValue() method. My requirement is not to fire the change event of combobox, when I am setting the value using setValue(). Any way I have solved the problem by overriding the the setValue() method. But I think it is better to give a optional boolean parameter in the setValue() to use or avoid the change event.

    Thanks...

  2. Please see the following:

    Code:
    Ext.application({
        name : 'Fiddle',
    
        launch : function() {
    
            var states = Ext.create('Ext.data.Store', {
                fields: ['abbr', 'name'],
                data : [
                    {"abbr":"AL", "name":"Alabama"},
                    {"abbr":"AK", "name":"Alaska"},
                    {"abbr":"AZ", "name":"Arizona"}
                ]
            });
            
            var combo = Ext.create('Ext.form.ComboBox', {
                fieldLabel: 'Choose State',
                store: states,
                queryMode: 'local',
                displayField: 'name',
                valueField: 'abbr',
                renderTo: Ext.getBody()
            });
            
            combo.on('change', function(combo){
               console.log('--- change ---'); 
               console.log(combo.getValue()); 
            });
            
            combo.setValue('AK');
            
            setTimeout(function(){
                console.log('--- set raw ---'); 
    	        combo.setRawValue('AZ');
    	        console.log(combo.getValue()); // value, but no change event
            },1000);
    
        }
    });

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,642
    Answers
    615
    Vote Rating
    401
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

  4. #3
    Sencha User
    Join Date
    Jun 2011
    Location
    India
    Posts
    28
    Vote Rating
    2
    tanmayasahu is on a distinguished road

      0  

    Default SetRawValue() is for setting the displayValue

    SetRawValue() is for setting the displayValue


    Hi Scott,
    SetRawValue() is for setting the displayValue, it will not change the value field of the combo am I right ?
    I want the value of the combobox will get changed and the change event should not fire.

    Thanks
    Tanmaya

  5. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,642
    Answers
    615
    Vote Rating
    401
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Please see the following:

    Code:
    Ext.application({
        name : 'Fiddle',
    
        launch : function() {
    
            var states = Ext.create('Ext.data.Store', {
                fields: ['abbr', 'name'],
                data : [
                    {"abbr":"AL", "name":"Alabama"},
                    {"abbr":"AK", "name":"Alaska"},
                    {"abbr":"AZ", "name":"Arizona"}
                ]
            });
            
            var combo = Ext.create('Ext.form.ComboBox', {
                fieldLabel: 'Choose State',
                store: states,
                queryMode: 'local',
                displayField: 'name',
                valueField: 'abbr',
                renderTo: Ext.getBody()
            });
            
            combo.on('change', function(combo){
               console.log('--- change ---'); 
               console.log(combo.getValue()); 
            });
            
            combo.setValue('AK');
            
            setTimeout(function(){
                console.log('--- set raw ---'); 
    	        combo.setRawValue('AZ');
    	        console.log(combo.getValue()); // value, but no change event
            },1000);
    
        }
    });

  6. #5
    Sencha User
    Join Date
    Jun 2011
    Location
    India
    Posts
    28
    Vote Rating
    2
    tanmayasahu is on a distinguished road

      0  

    Default


    Hi Scott, Thanks for sharing the example, Actually I was passing the raw value to the setRawValue() method. That was my mistake.....

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar