1. #1
    Sencha User
    Join Date
    Jul 2007
    Posts
    9
    Vote Rating
    0
    sysrun is on a distinguished road

      0  

    Default 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.

    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
    
        }
    });
    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","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?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jul 2007
    Posts
    9
    Vote Rating
    0
    sysrun is on a distinguished road

      0  

    Default


    Like this code?
    Code:
    	Ext.application({
    ...
    
        autoCreateViewport: true,
        launch: function() {
            Ext.direct.Manager.addProvider(Bonusserver.REMOTING_API);
        }
        }
    });
    This will need to be reworked as you are using autoCreateViewport though.
    So i cant use autoCreateViewport?

  4. #4
    Sencha User
    Join Date
    Jul 2007
    Posts
    9
    Vote Rating
    0
    sysrun is on a distinguished road

      0  

    Default


    Tried this Code in my app.js:

    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'
                }
            });		
        }
    });
    autoCreateViewport off and addProvider in launch-function. Same Error:

    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
    	}
    
    });

  5. #5
    Touch Premium Member bsbal's Avatar
    Join Date
    Oct 2011
    Location
    Basel, Switzerland
    Posts
    32
    Vote Rating
    0
    bsbal is on a distinguished road

      0  

    Default 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?

  6. #6
    Touch Premium Member bsbal's Avatar
    Join Date
    Oct 2011
    Location
    Basel, Switzerland
    Posts
    32
    Vote Rating
    0
    bsbal is on a distinguished road

      0  

    Default 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!

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You could set it in the constructor.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  8. #8
    Touch Premium Member bsbal's Avatar
    Join Date
    Oct 2011
    Location
    Basel, Switzerland
    Posts
    32
    Vote Rating
    0
    bsbal is on a distinguished road

      0  

    Default


    Question 1: How
    Question 2: Why is this necessary? Isn't it a Bug?

  9. #9
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  10. #10
    Touch Premium Member bsbal's Avatar
    Join Date
    Oct 2011
    Location
    Basel, Switzerland
    Posts
    32
    Vote Rating
    0
    bsbal is on a distinguished road

      0  

    Default


    I've tried your suggestion but had no luck.

    Store:
    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);
       }
               
    });
    Model:
    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' }
        ]
    
    
        
    });
    Without doing that in Controller,
    Code:
    onLaunch: function () {
    
    
            //Config Stores
            var UserKontrolleStore = Ext.getStore('UserKontrolle');
            UserKontrolleStore.proxy.api.read = MyExt.IksService.readUserKontrolle;
            UserKontrolleStore.proxy.api.update = MyExt.IksService.updateUserKontrolle;
    ...
    it comes with following error:
    'No direct function specified for this proxy' when calling method: [nsIDOMEventListener::handleEvent]