1. #1
    Ext User
    Join Date
    Mar 2008
    Posts
    11
    Vote Rating
    0
    deuns is on a distinguished road

      0  

    Default ComboBox, onSelect and superclass

    ComboBox, onSelect and superclass


    Hi

    I'm french and I'm new with extjs.

    I'm trying to use the comboBox component, and i've got some problems.
    I need to extend the select event of the combobox. I've read that when i use the onSelect i override the superclass event. I want to call this event but I don't know how to do.
    I've saw how to call a method but i suppose events aren't methods...

    If somebody can help me (just explain, I want to learn !!!).

    I show you my code :
    Code:
    var store_Fournisseur = new Ext.data.JsonStore({
    		// The url to send the request to
    		url: '../ajax/index.php?a=libelleFournisseur',
    		// What fields would you like mapped from the returned JSON
    		fields: ['libelleFournisseur', 'id_fournisseur', 'referenceFournisseurAstel', 'addresseFournisseur', 'cleRIB'], 
    		root: 'fournisseurs', // The object in your JSON that holds your records
    		totalProperty: 'record_count', // The object in JSON that holds the total count
    		autoLoad: true // Load the data automatically upon JSON store creation
    	})
    	var comboFournisseur = new Ext.form.ComboBox({
    	    store: store_Fournisseur,
    	    displayField:'libelleFournisseur',
    	    typeAhead: true,
    	    mode: 'local',	//necessaire pour afficher le chargement
    	    triggerAction: 'all',
    	    emptyText:'Choisir un fournisseur...',
    		hideTrigger: false,
    	    selectOnFocus:true,
    	    applyTo: 'libelleFournisseur',
    		onSelect: function(store_Fournisseur){
    			if(this.isExpanded()){
    				this.collapse();
    			}
    			var referenceFournisseurAstel = document.getElementById('referenceFournisseurAstel');
    			referenceFournisseurAstel.value = store_Fournisseur.data.referenceFournisseurAstel;
    			var addresseFournisseur = document.getElementById('addresseFournisseur');
    			addresseFournisseur.value = store_Fournisseur.data.addresseFournisseur;
    			var cleRIB = document.getElementById('cleRIB');
    			cleRIB.value = store_Fournisseur.data.cleRIB;
    		}
    	});
    When I delete the onSelect code, combobox functions (offcourse ^^) but, as you can see, i want to update other fields (when i select an item).

    Thank you for your help and sorry about my poor english :/

  2. #2
    Ext User
    Join Date
    Mar 2008
    Posts
    11
    Vote Rating
    0
    deuns is on a distinguished road

      0  

    Default


    I see that i've made a mistake... I use the 2.x extjs not the 1.x. If somebody could move my thread... ?!!

    thx =)

  3. #3
    Ext User
    Join Date
    Mar 2008
    Posts
    11
    Vote Rating
    0
    deuns is on a distinguished road

      0  

    Default


    Please, some help will be really appreciated. I didn't find some codes or examples which explain on how to do. I read again and again API but there's nothing.... :/

    I'm just looking for how to call the default listener onSelect of the comboBox, in order to extends his functionality.

    Great thanks

  4. #4
    Ext User
    Join Date
    Mar 2008
    Posts
    11
    Vote Rating
    0
    deuns is on a distinguished road

      0  

    Default


    I don't find the answer, and i need your help.
    The problem is that the combobox doesn't select the item i want. It selects the first proposition in the list. That's why i need to call the default action of the combobox.
    Thanks.

  5. #5
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    You might have a start by checking the tutorial on extending a class. There is also a stickied thread in the 2.0 forum that's a little more descriptive.

    The extension is coincidentally about comboBox.

  6. #6
    Ext User
    Join Date
    Mar 2008
    Posts
    11
    Vote Rating
    0
    deuns is on a distinguished road

      0  

    Default


    Thank you,
    I have already read the tutorial, and tried to extend "MyComboBox", without results, I will read your link in details. Thanks again =)

  7. #7
    Ext User
    Join Date
    Mar 2008
    Posts
    11
    Vote Rating
    0
    deuns is on a distinguished road

      0  

    Default


    It's ok, i did it. Your link is really helpfully !
    Thank you mjlecomte

  8. #8
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    Alright, good job.

    It will help other users if you post your final solution, and especially if you include a few comments either in your code or outside of it, that describe what you needed to do to solve your problem.

Thread Participants: 1