Results 1 to 3 of 3

Thread: Initial value of combo box

  1. #1

    Lightbulb Initial value of combo box

    Hi all,

    I have two combo boxes on my form. When I select the second should be filter based on the selection. So at initial level the second combo should have value something like "select.." and not anything else.

    Here is my code

    Code:
    {
                            x: 2,
                            y: 10,
                            xtype: 'label',
                            text: 'Device Category:'                
                        },{                         
                             x:125,
                             y:7, 
                             xtype:'combo', 
                            store: this.devicecategorycombo,                                
                            displayField:'devicecategory_name',
                            valueField:'devicecategory_id',
                            name:'devicecategory_id',
                            typeAhead: true,
                            mode: 'remote',
                            emptyText: 'Select Device Category',
                            triggerAction: 'all',
                             editable:false,
                            selectOnFocus:true,
                            anchor: '26%',
                            allowBlank:false,
                            id:'devicecategory_id',                        
                            listeners:{select:{fn:function(combo, value){                              
                                  var comboType = Ext.getCmp('devicetype_id');
                                  comboType.clearValue();                                           
                                comboType.setValue('Select Device Type');
                                comboType.store.filter('devicecategory_id', combo.getValue());  
                                comboType.enable();                           
                            }}}                        
                            
                        },{
                            x: 2,
                            y: 38,
                            xtype: 'label',
                            text: 'Device Type:'                
                        },{                         
                             x:125,
                             y:35,         
                            xtype:'combo',              
                            store: this.devicetypecombo,                                
                            displayField:'devicetype_name',
                            valueField:'devicetype_id',
                            name:'devicetype_id',
                            typeAhead: true,
                            mode: 'remote',
                            emptyText: 'Select Device Type',
                            triggerAction: 'all',
                             editable:false,
                            selectOnFocus:true,
                            anchor: '26%',
                            allowBlank:false,
                            id:'devicetype_id',        
                            disabled:true,
                            lastQuery:'',
                            listeners:{select:{fn:function(combo, value){
                                  var comboModel = Ext.getCmp('devicemodel_id');
                                  comboType.clearValue();
                                comboType.setValue('Select Device Model');                            
                                comboModel.store.filter('devicemodel_id', combo.getValue());
                                comboModel.enable();
                            }}}
                        }
    Please help

    Thanks
    Hiral Thaker

  2. #2

    Lightbulb Initial value in combo

    Hi, All

    I have one combo on my form. Which will be fill up from remote call. But initially I want to load this combo blank. Because it should be fill up based on first combo selection. So If I am not giving 'store' to this.devicemodelcombo it gives me this.store not defined.

    Code:
    // For device model
            this.LookupRecordModel = Ext.data.Record.create([
                      {name: 'devicemodel_id'},
                      {name:'devicetype_id'},
                      {name: 'devicemodel_name'}
            ]);
            //Store for combo box of device model
            this.devicemodelcombo = new Ext.data.Store({        
                 proxy: new Ext.data.HttpProxy({url: this.url})            
                ,baseParams:{mode:'getDeviceModel', objName:"devicemodel",sort:"devicemodel_name"}
                ,reader: new Ext.data.JsonReader({
                         id:'devicemodel_id',
                         root:'rows',
                         totalProperty:'totalCount'                    
                    },this.LookupRecordModel)            
             });
    
    // My field from items
    ,{                         
                             x:125,
                             y:63,         
                            xtype:'combo',             
                            store: this.devicemodelcombo,                                
                            displayField:'devicemodel_name',
                            valueField:'devicemodel_id',
                            name:'devicemodel_id',
                            typeAhead: true,
                            mode: 'remote',
                            emptyText: 'Select Device Model',
                            triggerAction: 'all',
                             editable:false,
                            selectOnFocus:true,
                            anchor: '26%',
                            disabled:true,
                            //allowBlank:false,
                            id:'devicemodel_id'
                        }
    Thanks

  3. #3
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    If you don't get an answer, please bump your initial thread, don't post a new one with the same thing.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Posting Permissions

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