Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext Premium Member
    Join Date
    Apr 2010
    Location
    Goiânia - GO - Brazil
    Posts
    38
    Vote Rating
    0
    gustavofranco is on a distinguished road

      0  

    Default ExtJS 3 to ExtJS 4 MVC

    ExtJS 3 to ExtJS 4 MVC


    Hi,

    I am working on migrating an application from ExtJS 3 to ExtJS 4 MVC and I'm getting some problems.
    Follow I'll list my classes:

    - Controller (/app/controller/Ramos.js)

    Code:
    Ext.define('App.controller.Ramos', {
        extend: 'Ext.app.Controller',
    
        views: [
            'ramo.List'
        ],
    
        init: function() {
            //console.log('Initialized Users! This happens before the Application launch function is called');
        }
    });
    - Model (/app/model/Ramo.js)

    Code:
    Ext.define('App.model.Ramo', {
        extend: 'Ext.data.Model',
    
        fields: ['id', 'nome', 'sigla']
    });
    - Store (/app/store/Ramos.js)

    Code:
    Ext.define('App.store.Ramos', {
        extend : 'Ext.data.Store',
    
        model  : 'App.model.Ramo',
    
        proxy  : {
            type   : 'ajax',
            url    : url+'/ramo/list.json',
            reader : {
                type   : 'json'
            }
        },
    
        sortInfo : {
            property  : 'nome',
            direction : 'ASC'
        }
    });
    - List of 'ramos' (/app/view/ramo/List.js)

    Code:
    Ext.define('App.view.ramo.List' ,{
        extend : 'Ext.grid.Panel',
        alias  : 'widget.ramolist',
    
        title   : 'Ramos',
        store   : 'Ramos',
        columns : [
            {header: 'Nome',  dataIndex: 'nome',  flex: 1},
            {header: 'Sigla', dataIndex: 'sigla', flex: 1}
        ]
    });
    - Viewport (/app/Viewport.js)

    Code:
    Ext.define('App.view.Viewport', {
        extend: 'Ext.container.Viewport',
    
        requires: [
            'Ext.layout.container.Border',
            'App.view.Menu',
            'App.clock.ToolbarClock'
        ],
    
        layout : 'border',
    
        items  : [{
            region      : 'north',
            split       : false,
            collapsible : false,
            margins     : '0 0 0 0',
            tbar        : {
                id          : 'basic-statusbar',
                items       : [
                '<b>SCOWEB - Sistema de gerenciamento de imobiliárias</b>',
                '->',{
                    text    : '',
                     id      : 'text',
                     iconCls : 'silk-user'
                 },
                 'Bem Vindo(a), <span id="main_username" class="username">'+(username || 'convidado')+'</span></b>',
                 '-',{
                     xtype : 'toolbarClock'
                  }]
            }
        },{
            xtype : 'appMenu',
            listeners: {
                'menuItemSelected' : function(tree, view) {
    
                    tabs = Ext.getCmp('app-tabpanel');
                    tabs.add({
                        xtype : view,
                        id    : 'tab-'+view
                    });
                }
            }
        },{
            region          : 'center',
            xtype           : 'tabpanel',
            id              : 'app-tabpanel',
            enableTabScroll : true,
            defaults        : {autoScroll:true},
            layout          : 'fit'
            
        }]
    });
    - Menu (/app/Menu.js)

    Code:
    Ext.define('App.view.Menu', {
        extend : 'Ext.tree.Panel',
        alias  : 'widget.appMenu',
    
        region        : 'west',
        title        : 'Menu',
        width        : 200,
        split        : true,
        collapsible    : true,
        xtype        : 'treepanel',
        rootVisible    : false,
    
        listeners   : {
            'itemclick': function(view, model) {
                this.fireEvent('menuItemSelected', this, model.data.view);
            }
        },
    
        initComponent : function() {
            Ext.define('NavLink', {
                extend : 'Ext.data.Model',
                fields : [
                    {name: 'id'  , type: 'string'},
                    {name: 'text', type: 'string'},
                    {name: 'view', type: 'string'}
                ],
                proxy: {
                    type : 'ajax',
                    url  : url+'/menu/list.json'
                }
            });
    
            // Returns [{'name':'ramo','leaf':true,'view':'ramolist','text':'Ramo','cls':'file'}]
            this.store = Ext.create('Ext.data.TreeStore', {
                model: 'NavLink',
                root: {
                    expanded: true
                }
            });
    
            this.callParent(arguments);
            this.addEvents('menuItemSelected');
        }
    });
    When I click on the menu option I try to open a tab with some view.

    Code:
    // view contain the value ramolist
     'menuItemSelected' : function(tree, view) {
    
                    tabs = Ext.getCmp('app-tabpanel');
                    tabs.add({
                        xtype : view,
                        id    : 'tab-'+view
                    });
                }
    When I try to add the tab I'm getting this error:

    Error.png

    Thanks in advance!

  2. #2
    Ext Premium Member
    Join Date
    Apr 2010
    Location
    Goiânia - GO - Brazil
    Posts
    38
    Vote Rating
    0
    gustavofranco is on a distinguished road

      0  

    Default


    I figure out that the problem is related with the Store.
    I made this change in the App.view.ramo.List class and the error disappear:

    Code:
    Ext.define('App.view.ramo.List' ,{
        extend : 'Ext.grid.Panel',
        alias  : 'widget.ramolist',
    
        title   : 'Ramos',
        store   : {
            fields: ['nome', 'sigla'],
            data  : [
                {nome: 'Ed',    sigla: 'ed@sencha.com'},
                {nome: 'Tommy', sigla: 'tommy@sencha.com'}
            ]
        },
        columns : [
            {header: 'Nome',  dataIndex: 'nome',  flex: 1},
            {header: 'Sigla', dataIndex: 'sigla', flex: 1}
        ]
    });
    But I don't know exactly what is the problem.
    Someone know?

  3. #3
    Sencha User
    Join Date
    May 2010
    Location
    Hamburg, Germany
    Posts
    97
    Vote Rating
    0
    ctp is on a distinguished road

      0  

    Default


    Did you try:

    Code:
    store: new App.store.Ramos
    But it seems I'm running into the same trouble: http://www.sencha.com/forum/showthre...ore-in-ExtJS-4
    Cheerio,

    Chris

  4. #4
    Ext Premium Member
    Join Date
    Apr 2010
    Location
    Goiânia - GO - Brazil
    Posts
    38
    Vote Rating
    0
    gustavofranco is on a distinguished road

      0  

    Default


    Yes man, I tried but didn't work. Thank you.

    My time is getting short. I think I'll give up to use the MVC Architecture.
    I tried to debug deeply into ext code but I couldn't figure out what is happening.

    The error is happening in the addManagedListener method of Ext.util.Observable.

  5. #5
    Sencha User
    Join Date
    May 2010
    Location
    Hamburg, Germany
    Posts
    97
    Vote Rating
    0
    ctp is on a distinguished road

      0  

    Default


    Do you use the Sencha SDK for generating the models, controller, stores etc? There're no many docs online but the Sencha CLI tools seem to be really interesting to automate these tasks.
    Cheerio,

    Chris

  6. #6
    Ext Premium Member
    Join Date
    Apr 2010
    Location
    Goiânia - GO - Brazil
    Posts
    38
    Vote Rating
    0
    gustavofranco is on a distinguished road

      0  

    Default


    Well, it seems that it is in beta version yet, but I'll take a look into this SDK.

    Tks!

  7. #7
    Sencha User
    Join Date
    May 2010
    Location
    Hamburg, Germany
    Posts
    97
    Vote Rating
    0
    ctp is on a distinguished road

      0  

    Default


    By the way: I'm documenting some Ext JS 4 stuff to keep it simple to begin with Ext JS 4, especially the MVC approach. If you find out some interesting stuff (docs, tutorials etc.) about using the Sencha SDK, please post the resources ;-) Thanks in advance ...
    Cheerio,

    Chris

  8. #8
    Ext Premium Member
    Join Date
    Apr 2010
    Location
    Goiânia - GO - Brazil
    Posts
    38
    Vote Rating
    0
    gustavofranco is on a distinguished road

      0  

    Default


    Ok, if I found something I'll send you.

    By the way, I found the problem.
    I was forgeting to put this "stores : ['Ramos']," on my controller class!

    Thank you for your help!

Similar Threads

  1. Passing arguments -- Refer Extjs In action book and ExtJs sample code
    By mrag74 in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 28 Apr 2011, 2:11 PM
  2. Replies: 2
    Last Post: 24 Apr 2011, 12:28 PM
  3. Replies: 0
    Last Post: 22 Apr 2011, 1:05 PM

Thread Participants: 1