-
30 Jan 2012 5:44 AM #1
MVC, Ext.direct & "the Tools"
MVC, Ext.direct & "the Tools"
Hi,
im not getting it:
If i use this code, all my App-Files where packed in the app-all.js BUT the Ext.direct-Calls in my stores throwing errors "Undefined" direct-functions.
If i use this code, the Ext.direct part is ok BUT none of my App-Files would be included in the app-all.js:Code:Ext.require(['Ext.direct.Manager',"Bonusserver.REMOTING_API"],function(){ Ext.direct.Manager.addProvider(Bonusserver.REMOTING_API); },this); Ext.application({ name: 'Bonus', appFolder: 'extapp', requires:[ 'Ext.direct.*', 'Bonus.*', 'Ext.view.*' ], controllers: [ 'XXX' ], autoCreateViewport: true } });
Code:Ext.require(['Ext.direct.Manager',"Bonusserver.REMOTING_API","Ext.app.Application"],function(){ Ext.direct.Manager.addProvider(Bonusserver.REMOTING_API); Ext.application({ name: 'Bonus', appFolder: 'extapp', requires:[ 'Ext.direct.*', 'Bonus.*', 'Ext.view.*' ], controllers: [ 'XXX' ], autoCreateViewport: true } }); },this);
So, how to use ExtMVC together with Ext.direct and the Sencha-Tools?
-
30 Jan 2012 8:40 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
What happens if you use addProvider within the Ext.application's launch method? This will need to be reworked as you are using autoCreateViewport though.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
31 Jan 2012 7:41 AM #3
Like this code?
Code:Ext.application({ ... autoCreateViewport: true, launch: function() { Ext.direct.Manager.addProvider(Bonusserver.REMOTING_API); } } });So i cant use autoCreateViewport?This will need to be reworked as you are using autoCreateViewport though.
-
31 Jan 2012 8:53 AM #4
Tried this Code in my app.js:
autoCreateViewport off and addProvider in launch-function. Same Error:Code:Ext.require('Ext.direct.Manager',function(){ Ext.direct.Manager.addProvider(Bonusserver.REMOTING_API); }); Ext.application({ name: 'Bonus', appFolder: 'extapp', paths:{ "Ext": "ext-4.0.7/src", "Bonus":"extapp", "Ext.ux":"ux" }, controllers: [ xxx ], autoCreateViewport: false, launch:function(){ Ext.direct.Manager.addProvider(Bonusserver.REMOTING_API); Ext.create('Ext.container.Viewport', { items: { html: 'My App' } }); } });
After async-load of the Model i get an error in Firebug:
Bonusserver.Mitarbeiter is undefined
Here is my Model:
Code:Ext.define('Bonus.model.Mitarbeiter', { extend: 'Ext.data.Model', fields: [ 'id', {name: 'name', type: 'string'}, {name: 'email', type: 'string'} ], proxy:{ type:'direct', directFn:Bonusserver.Mitarbeiter.getSelect } });
-
20 Mar 2012 6:24 AM #5
Same Problem
Same Problem
I'm at the moment at the same point. When I include my user classes in app-all.js then my extDirect functions are broken, if I exclude my user classes from app-all.js, extDirect functions are working fine.
Is there no solution for this problem arround?
-
21 Mar 2012 3:53 AM #6
Build with SDK working...
Build with SDK working...
I've managed it to get it working with 4.1 RC2 setting all directFn definitions (in models) in quotes and resetting directFn in controller code.
Only problem is, that proxy config has to be set in controller logic!
-
21 Mar 2012 4:07 AM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
You could set it in the constructor.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
21 Mar 2012 4:47 AM #8
Question 1: How
Question 2: Why is this necessary? Isn't it a Bug?
-
21 Mar 2012 4:57 AM #9Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
It's not a bug. The reason is the directFn is trying to look for a JS namespaced function which until the provider returns doesn't exist. I wish there was a way to work around it which you could define as a string and then in a constructor handle that, either way there isn't an elegant solution.
Code:Ext.define('MyApp.store.Direct', { extend : 'Ext.data.Store', .... constructor : function(config) { config = config || {}; config.proxy = { ... directFn : Some.direct.Function }; this.callParent([config]); } });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
21 Mar 2012 5:39 AM #10
I've tried your suggestion but had no luck.
Store:
Model:Code:Ext.define('Iks.store.UserKontrolle', { extend: 'Ext.data.DirectStore', storeId: 'UserKontrolle', model: 'Iks.model.UserKontrolle', autoLoad: false, sorters: ['themengebietPos', 'themaPos'], constructor: function (config) { config = config || {}; config.proxy = { type: 'direct', batchActions: false, paramOrder: 'id', api: { read: MyExt.IksService.readUserKontrolle, update: MyExt.IksService.updateUserKontrolle }, reader: { type: 'json', root: 'result', idProperty: 'id' } }; this.callParent(config); } });
Without doing that in Controller,Code:Ext.define('Iks.model.UserKontrolle', { extend: 'Ext.data.Model', fields: [ { name: 'id', type: 'int' }, { name: 'titel', type: 'string' }, { name: 'beschrieb', type: 'string' }, { name: 'verantwortlicherUser', type: 'string' }, { name: 'reqFile', type: 'bool' }, { name: 'bisDatum', type: 'date', dateFormat: 'MS' }, { name: 'ergebnisText', type: 'string' }, { name: 'status', type: 'int' }, { name: 'modDatum', type: 'date', dateFormat: 'MS' }, { name: 'modUser', type: 'string' }, { name: 'thema', type: 'string' }, { name: 'themaPos', type: 'int' }, { name: 'themengebiet', type: 'string' }, { name: 'themengebietPos', type: 'int' }, { name: 'kombiPos', type: 'string' } ] });
it comes with following error:Code:onLaunch: function () { //Config Stores var UserKontrolleStore = Ext.getStore('UserKontrolle'); UserKontrolleStore.proxy.api.read = MyExt.IksService.readUserKontrolle; UserKontrolleStore.proxy.api.update = MyExt.IksService.updateUserKontrolle; ...
'No direct function specified for this proxy' when calling method: [nsIDOMEventListener::handleEvent]
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote