PDA

View Full Version : Easier way of getting record value from ComboBox?



dbassett74
30 Jun 2009, 1:53 PM
So far, I am using the following in order to retrieve a specific field from a record in a store attached to a ComboBox:



pnl.getComponent('TextField1').setText(pnl.getComponent('ComboBox1').getStore().getById(pnl.getComponent('ComboBox1').getValue()).get('email'));
Seems like there should be a shorter way of getting access to the currently selected record in the ComboBox. Is there? I was hoping there was a getRecord() of the ComboBox but there isn't.

tryanDLS
30 Jun 2009, 2:02 PM
Maybe you're looking for findRecord instead of getRecord?

That method is marked private - not sure why since it's used in the example combo code in the API doc.

Also, not efficient to call getComponent multiple times for the same thing.