Hybrid View

  1. #1
    Sencha User Stephane Nadeau's Avatar
    Join Date
    May 2011
    Location
    Canada
    Posts
    1
    Vote Rating
    0
    Stephane Nadeau is on a distinguished road

      0  

    Default How to implement Ext.Direct in MVC architecture with ExtJs 4?

    How to implement Ext.Direct in MVC architecture with ExtJs 4?


    Hi,

    I used this with ExtJs 3.3

    Code:
    Ext.Direct.addProvider(WMS.API);
         Ext.Direct.on('exception', function(e) {
             Ext.Msg.alert('Exception', e.message);
         });
    And something like this to call my method

    Code:
      this.entityTypeStore = new Ext.data.DirectStore({
            reader: this.entityTypeReader,    
            api : {
                read : WMS.WS_EntityType.getAll
            }
        });
    How is the good way to implement this with Ext Js 4 in MVC architecture?

    Thank you in advance for all the answers

  2. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    4
    Vote Rating
    0
    DofD is on a distinguished road

      0  

    Default


    Hello.
    Have you found solution to the problem?

  3. #3
    Sencha - Ext JS Dev Team
    Join Date
    Jun 2011
    Location
    San Diego, CA
    Posts
    205
    Vote Rating
    40
    nohuhu has a spectacular aura about nohuhu has a spectacular aura about nohuhu has a spectacular aura about

      0  

    Default


    As of 4.2 Beta 2, this is not a problem anymore. Add Providers in Application's launch method, and use stringified Direct method names, like this:

    Code:
    Ext.define('MyApp.view.SomeGrid', {
        extend: 'Ext.grid.Panel',
    
        store: {
            proxy: {
                type: 'direct',
                api: {
                    read: 'WMS.WS_EntityType.getAll'
                }
            }
            ...
        }
    });
    
    Ext.define('MyApp.Application', {
        extend: 'Ext.app.Application',
    
        launch: function() {
            Ext.direct.Manager.addProvider(WMS.API);
        }
    
        ...
    });
    
    Ext.application('MyApp.Application');
    Regards,
    Alex.

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    4
    Vote Rating
    0
    DofD is on a distinguished road

      0  

    Default


    Thank You

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    2
    Vote Rating
    1
    ZIOLele is on a distinguished road

      0  

    Default


    I would like to add just that if you had

    Code:
    autoCreateViewport : true
    in your Application declaration then it would'nt work ( it will create the view port before registering the remote api) the solution is quite simple, just set autoCreateViewport to false, and than in Application.launch create the viewport manually after registering the remote api:

    Code:
        launch: function() {
         console.log("Launching Gestionale");
         Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
         this.viewport = Ext.create('Gestionale.view.Viewport');
        }
    Have a nice day :-D
    Michele

    Quote Originally Posted by nohuhu View Post
    As of 4.2 Beta 2, this is not a problem anymore. Add Providers in Application's launch method, and use stringified Direct method names, like this:

    Code:
    Ext.define('MyApp.view.SomeGrid', {
        extend: 'Ext.grid.Panel',
    
        store: {
            proxy: {
                type: 'direct',
                api: {
                    read: 'WMS.WS_EntityType.getAll'
                }
            }
            ...
        }
    });
    
    Ext.define('MyApp.Application', {
        extend: 'Ext.app.Application',
    
        launch: function() {
            Ext.direct.Manager.addProvider(WMS.API);
        }
    
        ...
    });
    
    Ext.application('MyApp.Application');
    Regards,
    Alex.
    Last edited by ZIOLele; 27 Mar 2013 at 9:33 AM. Reason: horrible typo

Thread Participants: 3