View Full Version : combobox assistance

9 Oct 2010, 6:14 PM

i have a combobox which is returning data ok. the combobox is part of the form and i want to populate a textfield based on the data returned from the combobox query.

i have the additional data returned from the combobox query.

how do use this data to populate a textfield ?


9 Oct 2010, 11:36 PM

10 Oct 2010, 2:16 AM
thx animal .. but how do i apply this ? am not one for just wanting answers, but i am no closer to implementing a solution. have flicked thru this forum but have not seen any similar queries. cheers.

10 Oct 2010, 4:27 AM
Well, your combo has a Store doesn't it? You must have created one to create a Combo.

And a Store has a Reader which it uses to read Records from raw data. You must have created one to create a Store.

And as linked to, the Reader keeps a reference to the raw data.

11 Oct 2010, 1:26 AM
you lost me at "hello" .. animal .. am still quite new to Ext.

If i saw a working example i could decipher it no problems.

// The Data Store
var dsVendor = new Ext.data.JsonStore({
fields: ['id', 'name', 'code', 'description'],
url: '/include/qry-list-vendor.asp',
baseParams: {
start: 0,
limit: cfgPageSize,
sort: 'name',
dir: 'ASC'
sortInfo: {
field: 'name',
direction: 'ASC'
totalProperty: 'totalCount',
root: 'records',
autoLoad: false,
remoteSort: true

// The Combo
var fsVendor = new Ext.form.FieldSet({
id: 'agreement-fs-vendor',
title: 'Vendor',
checkboxToggle: false,
items: [{
id: 'agreement-fs-vendor-name',
xtype: 'combo',
fieldLabel: 'Vendor Name',
loadingText: 'Searching...',
pageSize: 20,
hideTrigger: true,
forceSelection: true,
store: dsVendor,
displayField: 'name',
valueField: 'id',
minChars: 2
id: 'agreement-fs-vendor-desc',
fieldLabel: 'Description',
xtype: 'textfield'

In the example above, after selecting from the combo, how do i get the content so i can update the textfield ?


11 Oct 2010, 1:32 AM
Store has a reader. Check it's API docs. All config options are copied into properties, so you can access the reader.

This is YET ANOTHER example of these stupid shortcut classes obfuscating and confusing.

Use a Store, not the "convenience" subclass of it, JsonStore.

And don't copy/paste code and hope for the best with no knowledge.

You gain much more by investigating, learning and writing your own code.

11 Oct 2010, 1:35 AM
Add this to your combobox:

listeners: {
select: function(combo, record, index) {
(but I agree with Animal: Have a look at the API docs about what this code is doing)

11 Oct 2010, 1:48 AM
much appreciated .. yes i do read the apis to get as knowledgeable as possible .. have spend 6+ hrs reviewing the api to get my head around this to no avail, thus the post .. this is the 'Help' forum ...

11 Oct 2010, 1:56 AM
The key concept which is difficult to pick up (It's not explicitly documented) is that 99% of the time, config properties are copied directly into the object being constructed.

The exceptions are things like items where your array of child Components is used to create a MixedCollection object.