1. #1
    Sencha User Mango_lier's Avatar
    Join Date
    Apr 2007
    Posts
    191
    Vote Rating
    0
    Mango_lier is on a distinguished road

      0  

    Default Unanswered: Simple loading

    Unanswered: Simple loading


    I am developing a simple Touch app and my model, store, controller as well as Ext.application reside in one single file. The framework is still trying to load the Store, Model, and Controller from the default MVC folder hierarchy.

    The Ext.Loader and application are defined as below, What do I have to change here to instantiate the Store, Model, and Controller which are already defined in the same file.

    PHP Code:
    Ext.Loader.setConfig({

    });
    //debugger;
    Ext.application({
        
    models: ['UserGridModel'],
        
    stores: ['UserGridStore'],
        
    views: ['MainNav','UserGridList'],
        
    controllers: ['Business'],
        
    name'MyApp',
        
    launch: function() {
            
    Ext.create('MainNav', {fullscreentrue});
        }
    }); 
    Update:
    It is possible to have your model, controller, view in single JS file as long as you have the namespaces defined with a format of
    YouApp.(model|view|controller).AnyName. If these classes are defined before you hit Ext.application(...) block the loader will not initiate request to pick up these files from MVC folder hierarchy.

    Here is what I mean....
    PHP Code:
    Ext.define('pgGRSApp.model.svrGridModel', {
        
    extend'Ext.data.Model',
        
    config: {
            
    fields: [{
                
    name'ip_address',
                
    mapping'ip_address',
                
    type'string'
            
    }]
        }
    });
    Ext.define('pgGRSApp.store.svrGridStore', {
        
    extend'Ext.data.Store',
        
    requires: ['pgGRSApp.model.svrGridModel'],
        
    config: {
            
    storeId'IDsvrGridStore',
            
    model'pgGRSApp.model.svrGridModel'
        
    }
    }
    });
    Ext.define('pgGRSApp.view.svrGridList', {
        
    extend'Ext.Container',
        
    alias'widget.svrGridList',
        
    config: {
            
    layout: {
                
    type'fit'
            
    },
            
    items: [{
                
    xtype'list',
                
    id'dataList',
                
    itemTpl: ['<div>{ip_address}</div>'],
                
    store'IDsvrGridStore'
            
    }]
        }
    });
    Ext.define('pgGRSApp.view.svrGridNav', {
        
    extend'Ext.navigation.View',
        
    alias'widget.svrGridnav',
        
    requires: ['pgGRSApp.view.svrGridList'],
        
    config: {
            
    items: [{
                
    xtype'svrGridList',
                
    title'List of Servers '
            
    }]
        }
    });
    Ext.define('pgGRSApp.controller.svrGridCtrl', {
        
    extend'Ext.app.Controller',
        
    config: {},
        
    launch: function() {
            
    Ext.getStore('IDsvrGridStore').load({
                
    params: {
                    
    start0,
                    
    limit20
                
    }
            });
        }
    });
    Ext.application({
        
    models: ['pgGRSApp.model.svrGridModel'],
        
    stores: ['pgGRSApp.store.svrGridStore'],
        
    views: ['pgGRSApp.view.svrGridNav''pgGRSApp.view.svrGridList'],
        
    controllers: ['pgGRSApp.controller.svrGridCtrl'],
        
    name'pgGRSApp',
        
    launch: function() {
            
    Ext.create('pgGRSApp.view.svrGridNav', {
                
    fullscreentrue
            
    });
        }
    }); 

  2. #2
    Sencha Premium Member bricemason's Avatar
    Join Date
    Jan 2008
    Location
    Upstate NY
    Posts
    280
    Answers
    49
    Vote Rating
    42
    bricemason has a spectacular aura about bricemason has a spectacular aura about bricemason has a spectacular aura about

      0  

    Default


    The docs for the Ext.app.Application class tells the story. For the models config option:

    Each model is expected to exist inside the app/model directory and define a class following the convention AppName.model.ModelName.

    For stores:

    Each store is expected to exist inside the app/store directory and define a class following the convention AppName.store.StoreName.

    For controllers:

    Each controller is expected to exist inside the app/controller directory and define a class following the convention AppName.controller.ControllerName

    Why do you want to define it all in one file?

    Brice
    Brice Mason
    Front End Developer
    Modus Create

    @bricemason
    bricemason.com

    Sencha Touch Screencasts
    Vimeo - Sencha Touch Channel

    Github Projects:
    Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.

    Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.

    Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.

  3. #3
    Sencha User Mango_lier's Avatar
    Join Date
    Apr 2007
    Posts
    191
    Vote Rating
    0
    Mango_lier is on a distinguished road

      0  

    Default


    I read the documentation and could not figure out exactly why this is a requirement. My app is a very simple list, having 5 files spread across 4 directories is a bit too much. Also, four requests to the server to load 50 lines of javascript is bit excessive in my humble opinion.

    There has to be a way, Sencha guys are clever there must be a back door :-)

    I guess, I have to dig in the source to find out what is going on.

  4. #4
    Sencha Premium Member bricemason's Avatar
    Join Date
    Jan 2008
    Location
    Upstate NY
    Posts
    280
    Answers
    49
    Vote Rating
    42
    bricemason has a spectacular aura about bricemason has a spectacular aura about bricemason has a spectacular aura about

      0  

    Default


    Keeping these files separate promotes modularity which is a good thing. Each one of these files loading individually is also good in development mode for debugging purposes. But you're right, you wouldn't want to deploy to production that way. However there are tools to help you prepare your build for various environments such as qa and production. Have a look at the Sencha Cmd guide, specifically the section on deploying:

    http://docs.sencha.com/touch/2-1/#!/guide/command_app

    The guide will show you how to package an app for production which will concatenate and minify your scripts into a single file as well as help you configure your cache manifest.

    Brice
    Brice Mason
    Front End Developer
    Modus Create

    @bricemason
    bricemason.com

    Sencha Touch Screencasts
    Vimeo - Sencha Touch Channel

    Github Projects:
    Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.

    Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.

    Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.

  5. #5
    Sencha User Mango_lier's Avatar
    Join Date
    Apr 2007
    Posts
    191
    Vote Rating
    0
    Mango_lier is on a distinguished road

      0  

    Default


    quick look at the source shows some combination of
    Ext.exclude().require() should do the trick but I am not having much luck yet

  6. #6
    Sencha User Mango_lier's Avatar
    Join Date
    Apr 2007
    Posts
    191
    Vote Rating
    0
    Mango_lier is on a distinguished road

      0  

    Default


    polite bump, anyone can help?

  7. #7
    Sencha - Community Support Team grgur's Avatar
    Join Date
    Aug 2007
    Location
    Split, Croatia
    Posts
    154
    Answers
    10
    Vote Rating
    24
    grgur has a spectacular aura about grgur has a spectacular aura about

      0  

    Default


    Spending energy fighting conventions is not energy well spent.

    However, if you still want to go down that path, just remove the models, stores, views, and controllers from Ext.application and put your own bootstrap logic inside the launch method.
    Grgur Grisogono
    Ext JS in Action SE co-author
    Exercising awesomeness at Modus Create - Official Sencha Partner

    Get in touch for Sencha Touch Training
    @ggrgur

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar