-
14 Aug 2012 1:01 PM #1
Unable to define exception event on RestProxy - me not defined
Unable to define exception event on RestProxy - me not defined
ExtJs 4.1, Architect 2.1
I reported the same issue before, as bug DSGNR-1457
http://www.sencha.com/forum/showthre...ghlight=Svenna
Back then it was with build 298. It seems like the bug has returned, or that my confirmation of the fix was incorrect.
This code gives an exception of "me is not defined"
Code:Ext.define('BRes.model.Pulje', { extend: 'Ext.data.Model', idProperty: 'Id', proxy: { type: 'rest', url: 'http://d-box.sventore.com/dev/bowlingres.no/webroot/rest/puljer/', reader: { type: 'json', root: 'results' }, writer: { type: 'json', writeAllFields: false }, listeners: { exception: { fn: me.onRestproxyException, scope: me } } }, fields: [ { name: 'Id', type: 'int' }, { name: 'puljesegment', type: 'int' }, { dateFormat: 'Y-m-d H:i:s', name: 'start', type: 'date' }, { name: 'plasser', type: 'int' }, { name: 'segmentnavn' }, { name: 'startstr', persist: false }, { name: 'antalldeltagere', persist: false, type: 'int' } ], onRestproxyException: function(server, response, operation, options) { console.log(server,response,operation,options); } });Sven Tore Iversen
-
14 Aug 2012 1:05 PM #2
Hrm, we don't allow users to put in event handlers for a proxy when it is associated with a model.
Could you provide steps for how you were able to create this?Aaron Conran
@aconran
Sencha Architect Development Team
-
14 Aug 2012 1:20 PM #3
Hum..
Create Model, Add Proxy to model, then on the proxy click "Event Bindings" + icon.
The drop-down appearing only have the one option: 'exception'.
I've done it like this since the "Event Bindings" option was added.
However I can also drag the Basic Event Binding over to the proxy.
If this is not supposed to work. How am I supposed to catch server error messages for the REST proxy? And how should it be done within Architect? - except with an override. In my case overriding all rest proxies would be an option.
Image attached
Capture.JPGSven Tore Iversen
-
14 Aug 2012 1:46 PM #4
Okay, so first off I agree that there is a bug (or possibly several rolled into one) with this.
I cannot reproduce this. I created a model. I added a RestProxy to the model. I cannot drag/drop a basic event binding and or create via "Event Bindings" in the property grid.
We probably need to change this so that the proxy is constructed within the constructor of the model similar to how we do stores.Aaron Conran
@aconran
Sencha Architect Development Team
-
14 Aug 2012 10:06 PM #5
I've done this in more than one project, I can email you the project I'm working on now, just need a preferred address.
Sven Tore Iversen
-
14 Aug 2012 10:08 PM #6
aaron at sencha
Aaron Conran
@aconran
Sencha Architect Development Team
-
3 Dec 2012 9:44 AM #7
Workaround
Workaround
I know this thread is a bit old but there is an easy workaround - just add 'listeners' as a Custom property to the proxy. In my case that looks like this as shown in the Architect editor:
Code:listeners - object <-- editor box header // NOTE - this code added as a custom property to the Proxy, not via 'Event Bindings' // When added as an event the listener function call attempts to use a 'me' reference // & proxies have no 'me'. { exception: { fn: function(pxy, response, operation, options){ WhatEver(); } } }
-
4 Dec 2012 12:02 AM #8
Thanks for the Tip. after e-mailing with Aron he found that in my project, that was created before Architedt disabled exceptions I could add exceptions to a model proxy, but not when creating a new project.
Aron commented that they would likely allow it again new relases. Since I'm still working on the same projects I havent noticed it there is a change yet.Sven Tore Iversen
Success! Looks like we've fixed this one. According to our records the fix was applied for
DSGNR-2265
in
Sprint 37.


Reply With Quote