1. #1
    Sencha User
    Join Date
    Apr 2008
    Location
    Germany
    Posts
    24
    Vote Rating
    0
    Yasheena is on a distinguished road

      0  

    Question Ext.application and Ext.direct: How to setup?

    Ext.application and Ext.direct: How to setup?


    Hi,
    I want to create an Application with Ext.application. In one controller I use a store which uses Ext.direct. Where have I to put the line "Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);"?
    If I put it before "Ext.application({..." I get the error "Ext.direct is undefined". If I put it in the " launch: function() {..." area, I get the error that the class which I implement with Ext.direct is not defined.
    What is the correct way to use Ext.direct in Ext.application?

    Greetings,
    Wolfgang

  2. #2
    Sencha Premium Member
    Join Date
    Apr 2010
    Posts
    70
    Vote Rating
    2
    ralscha is on a distinguished road

      0  

    Default


    Hi

    Struggling with the same problem. Found this solution that works for me. Not sure if this is the "correct" approach.

    Code:
    Ext.require('Ext.direct.*', function() {
    	Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
    });
    
    Ext.application({
    ....
    });
    Greetings
    Ralph

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Location
    Prague
    Posts
    38
    Vote Rating
    0
    cubernatic is on a distinguished road

      0  

    Default


    Hi, having the same problem. My solution looks follow:
    Code:
    Ext.application({
        name: 'MyApp',
        .....
    
        launch: function() 
        {
            Ext.direct.Manager.addProvider(Ext.app.DirectAPI);
        }
    });
    I have also written a rpc Json_Server class for the Zend Framework which work like the Zend_Json_Server.

    Hope it helps.

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Location
    Prague
    Posts
    38
    Vote Rating
    0
    cubernatic is on a distinguished road

      0  

    Question


    @ralscha
    The solution you provided seem not to work.
    Trying it I get an error:
    Code:
    if (!provider.isProvider) {
    BUT ONLY if I use ext-all-debug.js.
    Using ext-debug.js it work fine!

    Why???

  5. #5
    Sencha Premium Member
    Join Date
    Apr 2010
    Posts
    70
    Vote Rating
    2
    ralscha is on a distinguished road

      0  

    Default


    Don't know where the problem is in your code. In my example application it works with ext.js and with ext-all.js.

    With ext-all.js you don't need Ext.require. You could try if it works after removing the Ext.require call.

  6. #6
    Sencha User
    Join Date
    Feb 2009
    Posts
    107
    Vote Rating
    0
    marman is on a distinguished road

      0  

    Default any update on this>

    any update on this>


    i am having the same issue: provider is undefined

    Code:
    <html>
    <head>
        <title>Hello Ext</title>
     
        <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css">
        
        <script type="text/javascript" src="ext-all-debug.js"></script>
        <script type="text/javascript" src="app.js"></script>
    </head>
    <body></body>
    </html>
    and my app.js file:

    Code:
    Ext.Loader.setConfig({
        enabled: true
    });
    
    
    Ext.application({
        name: 'MyApp'
    
        ,launch: function() {
            
            //provide feedback for any errors
            Ext.tip.QuickTipManager.init();
    
            Ext.direct.Manager.addProvider(Ext.app.DirectAPI);
        
            //console.log('Application launch!');
            
            var viewport= Ext.create('Ext.container.Viewport', 
                    {
                        layout: 'auto',
                        items: [ {
                            region: 'north',
                            html: '<h1 class="x-panel-header">Page Title</h1>',
                            height: 100,
                            border: false,
                            margins: '0 0 5 0'
                        }, {
                            region: 'center',
                            border: true,
                            layout: {
                                type: 'hbox',
                            }
                        }, {
                            region: 'south',
                            html: '<h1 class="x-panel-header">Page Footer</h1>',
                            height: 80,
                            border: false,
                            margins: '0 0 5 0'
                        }, ]            
                    });
        }
    });

  7. #7
    Sencha User
    Join Date
    Jun 2011
    Location
    Prague
    Posts
    38
    Vote Rating
    0
    cubernatic is on a distinguished road

      0  

    Default


    Think the problem is the loader.
    If we use ext-all.js, so all is loaded and no loader is required.
    If we use ext.js only the core is direct loaded and the must be load via the loader.

    Think so. Have to test it.


    PS: I hate the docu here form Sencha. Not really well done.

  8. #8
    Sencha User
    Join Date
    Feb 2009
    Posts
    107
    Vote Rating
    0
    marman is on a distinguished road

      0  

    Default


    but if i remove loader my app can not find my classes. Very frustrating. I tried adding:

    Code:
    Ext.require('SABER.summary.D03Panel');
    but it says i need to enable Ext.Loader!?!?!?!?

  9. #9
    Sencha User
    Join Date
    Jun 2011
    Location
    Prague
    Posts
    38
    Vote Rating
    0
    cubernatic is on a distinguished road

      0  

    Default


    Right. Have the same issue.

    The http://www.sencha.com/learn/getting-...with-ext-js-4/ is also not a help.

  10. #10
    Sencha User
    Join Date
    Feb 2009
    Posts
    107
    Vote Rating
    0
    marman is on a distinguished road

      0  

    Default


    If i get rid of the application and just do this:

    Code:
    Ext.Loader.setConfig({
        enabled: true
    });
    
    
    Ext.onReady(function() {
    ...

    it works. But now i am back to my problem of Ext.direct not POSTing to the correct URL