PDA

View Full Version : Integrating Ext.form.ComboBox w/ Existing AJAX call & Changing Ext.Window items



ben.gillis
17 Jan 2012, 11:00 AM
Hi,

I'm still looking through the forums, but not found quite what I need. This is probably trivial ?

1. An Ext.form.ComboBox on a tbar inside an Ext.Window needs to be populated with items using an existing javascript routine that does the AJAX call and returns JSON.

2. I need to switch out the items in the Ext.Window. (Update a Chart using the JSON data).


All I'm finding so far is using JsonStore's and not sure if the myWindow.add(myItems) is going to do the trick?

Thanks.

mitchellsimoens
17 Jan 2012, 11:19 AM
So all you have to do is remove and add items.

ben.gillis
17 Jan 2012, 2:48 PM
Perhaps I should be more clear.

- I need to take JSON data and load it into the combo box (a) after I've already rendered an Ext.Window (with the combo box in the tbar) (b) without using a Sencha store (I have to use an existing javascript method doing an AJAX call returning JSON).

I see the update method on Ext.form.ComboBox, but still looking for an example.

skirtle
17 Jan 2012, 6:01 PM
You can't avoid using a store: a combobox has a store no matter what.

However...

The store doesn't have to do the Ajax request. Given what you've described I'd say the easiest way to do it is to create an empty store for your combobox and just load the data in once you have it.

Some docs that might prove helpful:

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-method-add
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-method-loadData
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-method-loadRawData