View Full Version : Get store field value from ComboBox Selection

16 Sep 2010, 6:56 AM
I have the following store that loads a combobox:

var getPrevOrderDates = new Ext.data.Store({
url: 'action/queries.php',
baseParams: {task: 'previousOrders',branch:branchid,branchname:name},
reader: new Ext.data.JsonReader({
fields: ['invoiceid','invoice_date','processed'],
root: 'rows'

This store loads invoice dates into a combobox with the invoiceid as the value:

xtype: 'combo',
id: 'invoice_combo',
hideLabel: true,
triggerAction: 'all',
typeAhead: true,
name: 'invoiceid',
hiddenName: 'invoiceid',
mode: 'local',
store: getPrevOrderDates,
displayField: 'invoice_date',
valueField: 'invoiceid',
emptyText: 'Select Invoice Date...',
listeners: {
'select': function(){
invoice = this.getValue();
if(admin=='Y'){ // Only want to show this if processed=='N'
As you can see in the store there are three fields, the invoiceid, invoice_date, and processed. What I need is to be able to get the processed field value after selecting a specific invoice from the ComboBox. This would then determine whether a button is set to show() or left hidden. I have been trying to use the reader.jsonData but have not been able to access the specific value in a field.

Any help would be great!

16 Sep 2010, 9:24 AM
Figured it out. Took a long time to find out how to do it from the documentation, but here it is.

invoice = this.getValue(); // Value From Combo
var index = this.getStore().findExact('invoiceid', invoice); // Compares Value from combo to field invoiceid and returns the index
var record = this.getStore().getAt(index); // Gets the record at that index
processed = record.get('processed'); // Returns the value of the field 'processed'

22 Nov 2010, 2:18 PM
thanks for posting your findings swaitch, it saved me alot of time!