PDA

View Full Version : Avoid store load on first combobox DDL expand



janhov
24 Nov 2010, 3:53 AM
I have a combobox and a jsonstore. Even if the store is already loaded, it will load again on the first combobox dropdownlist expand. Can it be avoided? The ddl can be populated with whats already in the store, no?

Condor
24 Nov 2010, 4:16 AM
mode:'local'

janhov
24 Nov 2010, 4:24 AM
Obviously. For some uncertain reason I thought I could only use array stores with local mode. Thanks.

janhov
24 Nov 2010, 4:34 AM
Now, can I make it load remotely if the store is not loaded and locally if it is?

Like configuring the combo with mode:'remote' and then do something like combo.setMode('local') in the jsonstore load event?

Would like to keep the number of ajax requests as low as possible.

janhov
24 Nov 2010, 4:47 AM
I guess I should just leave it 'local' and load the store manually when the box is triggered. But on what event? And I have to wait for the load callback and expand the DDL manually?

Condor
24 Nov 2010, 9:11 AM
You could set the mode to local in the store load event.

janhov
24 Nov 2010, 9:56 AM
Yes, combo.mode = 'local' works. Thanks. The application is intended for slow African servers, so it's worth the effort.