PDA

View Full Version : [FIXED] SA4 Bug when adding update event to a Store



alwoss
8 Sep 2016, 6:34 AM
Hi noticed this when adding an update event handler via the Basic Event Bindings in Architect 4.0.

When I do this architect generates this code:


listeners: {
update: {
fn: me.onStoreUpdate,
scope: me
}
}
,


onStoreUpdate: function(store, record, operation, modifiedFieldNames, details, eOpts) {


},


And after compiling and trying out the app, the browser will choke on the reference to me.

petr.felzmann
8 Sep 2016, 10:14 PM
Thanks for the report! I have opened a bug in our bug tracker.

faireu
9 Sep 2016, 3:44 AM
Same problem on my apps

Please fix ASAP.

faireu
16 Oct 2016, 1:51 AM
The issue still exist if the store is not "global" but tied to specific view.

petr.vecera
16 Oct 2016, 3:25 AM
The issue still exist if the store is not "global" but tied to specific view.

Could you be please more specific ? Share some code?

You mean when using store in ViewModel ? I can't see any problem when adding ViewController event binding (listener) to the store in ViewModel.

faireu
17 Oct 2016, 3:49 AM
Sorry, I got this error on a 3.5 project converted to 4.0 but I'm unable to reproduce the error on new projects.

Forget my post.

Thanks

petr.vecera
17 Oct 2016, 3:55 AM
Sorry, I got this error on a 3.5 project converted to 4.0 but I'm unable to reproduce the error on new projects.

Forget my post.

Thanks

I see. If the issue still persists. Try to remove / add the listener again. If it doesn't work, try to duplicate whole class in project inspector. This should regenerate the code.

EricRicher
18 Oct 2016, 7:50 AM
I have the same issue. Here's the code generated by SA when I add a listener for a "load' event to the UserStore store in a ViewModel.

I am new to using SA 4 with ViewModel and ViewController. Maybe I am not doing it properly but I want to listen the load event on the UserStore. Eventually, my MainTabPanelViewModel will have multiple stores and I will add listeners to each store.

SA adds me in front of the onStoreLoad function in the listener config. When loading in the browser, me is not defined and an exception is thrown.


Ext.define('Myapp.view.MainTabPanelViewModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.maintabpanel',


requires: [
'Ext.data.Store',

'Ext.data.proxy.Ajax',
'Ext.data.reader.Json'
],


stores: {
UserStore: {


model: 'Myapp.model.User',
clearOnPageLoad: false,
proxy: {


type: 'ajax',
url: '/e/me',
reader: {


type: 'json'

}

},

listeners: {

load: {

fn: me.onStoreLoad

}

}

}
},


onStoreLoad: function(store, records, successful, operation, eOpts) {
console.log('UserStore data loaded');
},


});

EricRicher
18 Oct 2016, 7:59 AM
My mistake.

I should have created a ViewController event instead an event on the store within the ViewModel.







I have the same issue. Here's the code generated by SA when I add a listener for a "load' event to the UserStore store in a ViewModel.

I am new to using SA 4 with ViewModel and ViewController. Maybe I am not doing it properly but I want to listen the load event on the UserStore. Eventually, my MainTabPanelViewModel will have multiple stores and I will add listeners to each store.

SA adds me in front of the onStoreLoad function in the listener config. When loading in the browser, me is not defined and an exception is thrown.


Ext.define('Myapp.view.MainTabPanelViewModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.maintabpanel',


requires: [
'Ext.data.Store',

'Ext.data.proxy.Ajax',
'Ext.data.reader.Json'
],


stores: {
UserStore: {


model: 'Myapp.model.User',
clearOnPageLoad: false,
proxy: {


type: 'ajax',
url: '/e/me',
reader: {


type: 'json'

}

},

listeners: {

load: {

fn: me.onStoreLoad

}

}

}
},


onStoreLoad: function(store, records, successful, operation, eOpts) {
console.log('UserStore data loaded');
},


});

grosst
19 Oct 2016, 10:10 AM
My mistake.

I should have created a ViewController event instead an event on the store within the ViewModel.


you could also create a function and manually define the listener.