PDA

View Full Version : populate comboBox using remote JSON store



zohaib
26 Nov 2009, 2:59 AM
Hi,

I am using first example as per following url

http://www.extjs.com/deploy/dev/examples/form/combos.html

I have local data store in js file and I want to fetch data from db and show using json.
I am trying to use remote data store using url in data store definition but it is not working.

I have attached all working pages with this thread.




// simple array store
var store = new Ext.data.ArrayStore({
fields: ['abbr', 'state', 'nick'],
data : Ext.exampledata.states // from states.js
});


var dd = new Ext.data.ArrayStore({
url: 'states.php',
fields: ['state'],
data : Ext.countrydata.states // from states.js

});


var remoteJsonStore = new Ext.data.JsonStore({
fields: ['state'],
url : 'http://localhost/ComboBoxes_files/states.php',
data : Ext.countrydata.states
});


var combo = new Ext.form.ComboBox({
store: remoteJsonStore,
displayField:'state',
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
applyTo: 'local-states'
});

zohaib
26 Nov 2009, 5:09 AM
I check following article

http://www.quizzpot.com/2009/10/combo-box-loaded-dynamically-and-remotely/

but with

1.combo box keyword search facility available in local data store.
2.combo box keyword search facility not available in remote data store.

any idea

I want

1.Remote data combo box
2.key word search facility in combo
3.data listing from remote data store.

jsemmanuel
26 Nov 2009, 6:21 AM
You don't need
data : Ext.countrydata.states in the remoteJsonstore,
and you need to set mode:'remote' in the ComboBox. Try and see if it works.