Search code examples
extjscomboboxstore

How to call the remote store for combobox in extjs v7.5?


I have a combobox with data downloaded from a remote server. I want a request to be sent every time I click on the combobox, because I want to dynamically set parameters in proxy.setExtraParams(params). I set params in beforeQuery function. I have this example that I found on the Internet. In my application, the combo works in a similar way. https://fiddle.sencha.com/#fiddle/3ij5&view/editor

However, it works fine in version 7.4 and does not work in version 7.5.

The documentation for 7.5 says that when queryMode: 'remote' you have to manually load the store. Where do I call store.load() so that the combo has time to process the parameters for the proxy?


Solution

  • You have to set the autoLoad to true.

    Because you do not want to load the store initially, you have to add a listener (as you did) and set the autoLoad.

    You just want to call the listener once, because after that the autoLoad is set.

            listeners: {
                beforeQuery: {
                    fn: function (queryPlan) {
                        console.log('[ComboBox::beforeQuery] set autoLoad to true');
                        this.getStore().setAutoLoad(true);
                        return queryPlan;
                    },
                    single: true
                }
            }