PDA

View Full Version : Trying to load proxy store dynamically on controller's initialize function in EXTJS 7



radhikar260506
16 Jan 2020, 4:03 AM
Hi I have button on click of which i need to load a view with a grid. This view is bound to a viewModel which has an ajax proxy store. I have a ajax proxy defined using an API. But this API is dynamically set on the controller using the below code.



store.getProxy().url = "someDynamicUrl";
store.load();



If i use this, i get an error like 'Cannot read property 'getProxy' of undefined'. It seems like the store is not yet initialised and am trying to set its proxy.

The same above code works if deferred for some seconds. as below



Ext.defer(function(){
store.getProxy().url = 'someDynamicUrl';
store.load();
}, 1000)



It clearly means that my store is not initialised when the controller's initialise function is called. Can someone please tell me how to proceed with this?