Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Location
    India
    Posts
    29
    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,927
    Answers
    656
    Vote Rating
    443
    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
    29
    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,927
    Answers
    656
    Vote Rating
    443
    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
    29
    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

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi