1. #1
    Ext JS Premium Member Joyfulbob's Avatar
    Join Date
    Feb 2008
    Posts
    176
    Vote Rating
    1
    Joyfulbob is on a distinguished road

      0  

    Default SimpleStore ComboBox's value does not display on Load

    SimpleStore ComboBox's value does not display on Load


    I've got a combo box that I'm checking it's value after they tab out and conditionally display 2 other fields. I've got it working, but if I've got hiddenName: 'QTACPhidden' defined when the panel loads (Ext.getCmp('qhEditPanel').getForm().load({) the combo box does not display anything; if I remove hiddenName then it does display correctly. I use the hiddenName to check it's value on blur so I need it if there's another way to retrieve the value dynamically as soon as they tab out that would be great.

    I've experimented with various ways without any success. In FF I searched the DOM for a property in the combo box that I could examine, but coulnd't find anything that had the value in it.

    Here's my code:

    PHP Code:
    QTACPfield = new Ext.form.ComboBox({
         
    store: new Ext.data.SimpleStore({
             
    fields: ['key''label'],
         
    data: [
            [
    'A','Accepted'],['P','Pending'],['R','Rejected']
         ]
         }),
            
    id:'QTACPfield',
        
    name'QTACP',
            
    hiddenName'QTACPhidden',
            
    fieldLabel'Accepted?',
            
    displayField:'label',
            
    valueField:'key',
            
    mode'local',
            
    typeAheadtrue,
            
    triggerAction'all',
            
    selectOnFocus:true,
            
    forceSelection:true,
        
    width90,
             
    listeners: {
             
    'blur':{
             
    fn: function(storerecordsoptions){
               
    Ext.example.msg('Debug',' acceptance chg: hidden: ' QTACPfield.hiddenField.nextSibling.value ' s/o: ' QTACPfield.originalValue  );
              
    // if ( QTACPfield.isDirty() ) {    // if changed
                  
    if ( QTACPfield.hiddenField.nextSibling.value !== QTACPfield.originalValue ) { 
                     
    // Accepted...
                     
    if ( Ext.getCmp('QTACPfield').getValue() == "A" ) {    
                         
    Ext.getCmp('QTADTfield').setValuedt );
                         
    Ext.getCmp('QTADTfield').show();
                         
    Ext.getCmp('QTRRSfield').hide();
                         
    Ext.MessageBox.confirm('Confirmation','EPDM Item Masters will now be created; proceed?'this.createEPDMItems );
                     }
                     
    // Pending...
                     
    if ( Ext.getCmp('QTACPfield').getValue() == "P" ) {    
                         
    Ext.getCmp('QTADTfield').setValue'' );
                         
    Ext.getCmp('QTRRSfield').hide();
                         
    Ext.getCmp('QTADTfield').hide();
                     }
                     
    // Rejected...
                     
    if ( Ext.getCmp('QTACPfield').getValue() == "R" ) {
                         
    Ext.getCmp('QTADTfield').setValuedt );
                         
    Ext.getCmp('QTRRSfield').show();
                         
    Ext.getCmp('QTADTfield').hide();
                     }
              }
             },
             
    scopethis
            
    }
           }
    }); 
    Also, on the load, I can't seem to retrieve the value either:

    PHP Code:
              Ext.getCmp('qhEditPanel').getForm().load({
                    
    root:'data',       
                    
    waitMsg'Loading Quote...',
                    
    url'QTEHDR',
                    
    params: {
                      
    submit'RETRIEVE',
                      
    process'EDIT',
                      
    processType'DETAIL',    
                      
    QTESQiQTESQ,
                      
    QTERViQTERV
                    
    },
                    
    success: function(response){
                        
    Ext.example.msg('Debug','hidden: ' QTACPfield.hiddenField.nextSibling.value ' s/o: ' QTACPfield.value  ' getValue: ' +  Ext.getCmp('QTACPfield').getValue() );
                        
    QTACPfield.hiddenField.nextSibling.value Ext.getCmp('QTACPfield').getValue(); 
    I guess I need to learn how to getValue() on a simpeStore combo box.

    Thanks in advance!

  2. #2
    Ext User
    Join Date
    Nov 2007
    Location
    São José do Rio Preto, Brazil
    Posts
    69
    Vote Rating
    0
    leolima is on a distinguished road

      0  

    Default


    I got the same problem today...
    I´m using ExtJs 2.3, and when I add hiddenName into the Combobox, the values don´t display...
    I can select them, but don´t display the result
    I´m looking for a solution, if I got one I post here rs
    Leonardo Lima - Programador Web
    São José do Rio Preto

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    101
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    @Joyfulbob:
    The data that is loaded in the form should contain a value for the hiddenName (QTACPhidden) and not for the id or name.

    @leolima:
    This is usually caused by a misconfigured combobox. Can you post the config object you are using to create the combobox?

  4. #4
    Ext User
    Join Date
    Apr 2010
    Posts
    6
    Vote Rating
    0
    vibhakhushi is on a distinguished road

      0  

    Exclamation Drop down list for a combo box in ExtJS 2.3

    Drop down list for a combo box in ExtJS 2.3


    Hello Condor, here is my code for combobox which is in a form panel. store is loaded with data, but i'm not getting the drop down list Please tell me where i have gone wrong. I'm a newbie in extjs. i'm using extjs 2.3 for my project work.

    Store :

    var dept_names = [
    ['EC','Electronics and Communication'],
    ['EE','Electrical and Electronics'],
    ['TC','Telecommunication Engineering'],
    ['IT','Instrumentation and Electronics Engineering']
    ];


    var comboStore = new Ext.data.SimpleStore({

    autoLoad:true,

    fields: ['deptId','deptName'],

    });

    comboStore.loadData(dept_names);



    Combobox in a form panel:

    {

    xtype:'combo',

    fieldLabel:'Department Name',

    allowBlank:false,

    id:'department',

    name: 'department',

    store : comboStore,

    emptyText:'Select the Department from the List',

    autoShow: true,

    forceSelection:true,

    autoHeight:true,

    selectOnFocus:true,

    triggerAction: 'all',

    displayField:'deptName',

    valueField:'deptId',

    mode:'local',

    width:300
    }

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    101
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Code:
    var dept_names = [
        ['EC', 'Electronics and Communication'],
        ['EE', 'Electrical and Electronics'],
        ['TC', 'Telecommunication Engineering'],
        ['IT', 'Instrumentation and Electronics Engineering']
    ];
    var comboStore = new Ext.data.SimpleStore({
        //autoLoad: true, <- not needed if you use loadData
        fields: ['deptId', 'deptName'],
    });
    comboStore.loadData(dept_names);
    
    {
        xtype: 'combo',
        fieldLabel: 'Department Name',
        allowBlank: false,
        id: 'department',
        //name: 'department', <- you want hiddenName instead of name
        hiddenName: 'departmentId', // <- can't be the same as the id!
        store: comboStore,
        emptyText: 'Select the Department from the List',
        //autoShow: true, <- why?
        forceSelection: true,
        //autoHeight: true, <- why?
        selectOnFocus: true,
        triggerAction: 'all',
        displayField: 'deptName',
        valueField: 'deptId',
        mode: 'local',
        width: 300
    }

  6. #6
    Ext User
    Join Date
    Apr 2010
    Posts
    6
    Vote Rating
    0
    vibhakhushi is on a distinguished road

      0  

    Default


    I tried this Condor... but still its not working


    {

    xtype:'combo',

    fieldLabel:'Department Name',

    allowBlank:false,

    id:'department',

    hiddenName:'departmentId',

    emptyText:'Select the Department from the List',

    forceSelection:true,

    selectOnFocus:true,

    typeAhead:false,

    triggerAction: 'all',

    store : comboStore,

    displayField:'deptName',

    valueField:'deptId',

    mode:'local',

    width:300

    }

  7. #7
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    101
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    What exactly is not working?

  8. #8
    Ext User
    Join Date
    Apr 2010
    Posts
    6
    Vote Rating
    0
    vibhakhushi is on a distinguished road

      0  

    Default


    output.jpgHello Condor,
    The drop down list is not coming in the combobox. I only get the emptytext which i have assigned for the combo

  9. #9
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    101
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    There doesn't seem to be anything wrong with your code.

    It could be that the list is displaying, but behind the window (see bugreport).

  10. #10
    Sencha User
    Join Date
    Mar 2011
    Posts
    208
    Vote Rating
    0
    bee is on a distinguished road

      0  

    Default


    Hi Condor, I have a different issue that when I select value from combobox, the value does not populate in combo box. means selected values for eg if I select A, A does not display on combobox/editorgridpanel. I am using editor grid panel.