PDA

View Full Version : JsonStore autoLoad misunderstanding?



abtrapp
15 Feb 2011, 12:49 AM
Hi!

I have a typical master / detail combo with a simple store:


var funnyStore = new Ext.data.JsonStore({autoLoad: false, url:...

a simple master combobox with a listener:



listeners:{
select: function(combo, value) {
modelDest = Ext.getCmp('target-combo');
modelDest.setDisabled(true);
modelDest.setValue('');
funnyStore.removeAll();
funnyStore.reload({params: {facilityId: value.data.facility_id},
callback: function(){
modelDest.setDisabled(false);
...


And a target (store: funnyStore).

The whole thing is working after I visited the target combo once. The first time I focus the target combo it loads the funnyStore without the additional parameters. The funnyStore or the ID of the target combo are nowhere else to be found (renamed them just to check, ...) - so my only idea is, that when it receives the focus the autoLoad: false is ignored.

Is there any workaround for this (or do I have to jump to every combo after loading a form)? :((

Thank you very much in advance!

Kind regards,
Anton

mitchellsimoens
15 Feb 2011, 5:11 AM
autoLoad on the Store means that if set to true, when the Store is created it will attempt to load.

ComboBox with mode set to 'remote' will load the Store when you click on the trigger to see the list.

If you set mode to 'local' then the ComboBox will assume the Store has been loaded and will not attempt to load the Store. You will have to manage loading at that point.

abtrapp
15 Feb 2011, 5:15 AM
THANKS, THANKS, THANKS!!!

mitchellsimoens
15 Feb 2011, 5:16 AM
No problem. When I first started, I hated using ComboBox but things are going to be better and smaller code with ExtJS 4 that is nearing launch.

abtrapp
15 Feb 2011, 5:19 AM
Sounds great!