Wednesday, 14 December 2011

HOW CAN YOU GET LABEL FIELD OF COMBO BOX IN EXTJS?

Use of getRawValue() method you can get label field of  combo box in ExtJs.

Example :
    You have one combo field like
    var otStore = new Ext.data.ArrayStore({
             data : [[' 1','OT1'],[' 2','OT 2'],['3','MINOR OT'],['4','OPTHAL OT']],
fields: ['id','displayValue'],
sortInfo: {
field: 'displayValue',
direction: 'ASC'
}
    });

     otStore is one static Store loaded into combo field      

               items : [{
                       xtype : 'combo',
id:'ot',
store: otStore,
valueField:'value',
displayField:'label',
mode: 'local',
triggerAction : 'all',      
selectOnFocus:  true,
editable      : true,
forceSelection: true,
fieldLabel : 'Parent Menu',              
                 
}]
}]

Now you can get label field("OT,MINOR OT") by use of

      "  $('$ot').getRawValue(); "

now youu can get all values like OT,MINOR OT and etc.

1 comment:

  1. You can also get the combo label value by
    Ext.getCmp('ot').getRawValue();

    ReplyDelete