Results 1 to 6 of 6

Thread: problem with Combo box

  1. #1

    Question problem with Combo box

    hello friends,

    first of all, I want to say that my english is not good, I hope to be clear in order to get some help.

    I am new on ExtJs, I think it is a powerfull framework therefore I am doing some tests in order to learn how to use it.

    I want to do a form with 2 combo box and a button with POST method
    My progress is too slow I just have created 2 combos with the submit button, but I can't send de right post values to my PHP page, when I click the button the post method sends the description of the combos instead of the values (the Ids).

    What is wrong here?

    this is my file.js
    Code:
    Ext.ns("sistema");
    
    sistema.LinkedComboBoxTutorial = {
        init: function(){
        
        
            var empresasStore = this.getStore();   
    
            var municipiosStore = new Ext.data.JsonStore({
                autoLoad: true,
                url: 'datosEmpresas.php',
                baseParams:{ accion: 2 }, 
                root: 'datos',
                totalProperty: 'total',
                fields: [
                         {name:'value', type: 'string'},
                         {name:'label', type: 'string'},                     
                         ]
            });    
        
            var comboMunicipio =new Ext.form.ComboBox({
                fieldLabel: 'Municipio',
                name: 'comboMunicipio',
                forceSelection: true,
                store: municipiosStore,
                emptyText: 'Selecciona un Municipio...',
                triggerAction: 'all',
                displayField: 'label',
                valueField: 'value',
                mode: 'local',       
                //hideTrigger:true,
                editable: false                
                //minChars:3
            });
                
            var comboEmpresas = new Ext.form.ComboBox({                
                    fieldLabel: 'Empresas',
                    name: 'comboEmpresas',
                    forceSelection: true,
                    store : empresasStore,            
                    emptyText: 'Seleccionar una empresa',
                    triggerAction: 'all',            
                    editable: false,
                    displayField: 'EMPRESA',
                    valueField: 'CVE_EMPRESA',
                    width: 500,
                    disabled: true,
                    mode: 'local'
                    
                });
        
            comboMunicipio.on('select',function(cmb,record,index){            
                comboEmpresas.clearValue();
                comboEmpresas.enable();
                empresasStore.load({ 
                                        params:{
                                            accion: 1,
                                            municipio:record.get('value')                
                                            } 
                                     });           
            },this);
               
            var panel1 = new Ext.FormPanel({            
                url: 'datosEmpresas.php',            
                title: 'Seleccione Filtros',            
                items: [comboMunicipio, comboEmpresas],
                region: 'south',
                //layout: 'form',
                height: 150,
                buttons: [ {text: 'Buscar', 
                            handler: function(){
                                
                                panel1.getForm().submit();                            
                            }
                         } ]
            
                //iconCls: 'users'
            });
            
            var panel2 = new Ext.Panel({            
                region: 'center'                   
            });
                   
            /**
             * PANEL PRINCIPAL
             */
            var main = new Ext.Panel({
                
                title: 'Banco de Datos',            
                height:600,
                layout: 'border',
                defaults: {
                    //collapsible:true,
                    border: true,
                    bodyStyle: 'padding:10px;',
                    //titleCollapse: true,
                    
                },
                items: [panel1,panel2]//,panel3]
                
            });
            main.render('panel');
            
        },
    
        getStore: function(){
            var store = new Ext.data.JsonStore({
                url:'datosEmpresas.php',
                root:'datos',
                fields: ['CVE_EMPRESA','EMPRESA']
            });
            return store;
        }
    
            
        
    }
    
    Ext.onReady(sistema.LinkedComboBoxTutorial.init,
               sistema.LinkedComboBoxTutorial);

    thanks

  2. #2

    Default

    By Default Ext Js comboBox submit its displayfield value as a form data. To enable submit the valuefield as form data you should add hiddenName config property to your combo box setting

    HTML Code:
     var comboMunicipio =new Ext.form.ComboBox({
    hiddenName:'myHiddenId',
                fieldLabel: 'Municipio',
                name: 'comboMunicipio',
                forceSelection: true,
                store: municipiosStore,
                emptyText: 'Selecciona un Municipio...',
                triggerAction: 'all',
                displayField: 'label',
                valueField: 'value',
                mode: 'local',       
                //hideTrigger:true,
                editable: false                
                //minChars:3
            });
    Hope this helps.

    [/HTML]

  3. #3

    Default

    your advice is great, It works pretty fine

    thank you

  4. #4

    Default

    Hi i created two combo boxes for my application

    One combo box mode is local and the other combo box mode is remote

    In the application if i enter a word in the combo with local mode it lists all the datas in that word, but if i enter a word in the combo with remote mode it does not lists all the datas in that word after giving 4 letters only it lists..

    How to resolve this problem?

    The following is my code..

    CQ.Ext.onReady(function(){

    var language = [['en'],
    ['fr'],
    ['de'],
    ['it']
    ];

    var language_store = new CQ.Ext.data.SimpleStore({
    fields: ['id'],
    data : language
    });

    var language_combo = new CQ.Ext.form.ComboBox({
    store: language_store,
    fieldLabel: 'Language',
    displayField:'id',
    id : 'language',
    typeAhead: true,
    mode: 'local',
    triggerAction: 'all',
    emptyText:'Select a Language...',
    editable: true,
    allowBlank: false
    });

    var lang = "de";
    var store = new CQ.Ext.data.JsonStore({
    url: '/bin/logica/autocomplete?lang='+lang ,
    idProperty: 'id',
    fields: ['id']
    });

    var search_combo = new CQ.Ext.form.ComboBox({
    storetore,
    fieldLabel: 'Search',
    displayField:'id',
    typeAhead: true,
    mode: 'remote',
    queryParam: 'term',
    editable: true,
    hideTrigger: true,
    selectOnFocus:true,
    allowBlank: false
    });

    var fp = new CQ.Ext.FormPanel({
    frame: true,
    title:'Auto Search',
    labelWidth: 110,
    width: 600,
    renderTo:'autosearch',
    bodyStyle: 'padding:0 10px 0;',
    items: [language_combo,search_combo]
    });
    });


    Regards

    Thandayuthapani

  5. #5
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    You are checking to see if it's querying the server, and finding that it is not?

    http://dev.sencha.com/deploy/dev/doc...ember=minChars

  6. #6

    Default

    Thanks animal i got it

Similar Threads

  1. problem with combo box
    By bourne in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 24 Mar 2009, 10:41 PM
  2. [solved] Combo box needs to be displayed as ordinary HTML combo box.
    By Prathima in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 29 Dec 2008, 11:05 PM
  3. combo box problem :( please help me
    By achebv in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 2 Jun 2008, 8:50 AM
  4. Replies: 1
    Last Post: 20 May 2008, 4:22 PM
  5. problem with combo box!
    By pradeep_123 in forum Ext 1.x: Help & Discussion
    Replies: 7
    Last Post: 24 Mar 2007, 10:30 PM

Posting Permissions

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