Results 1 to 2 of 2

Thread: Best Practices - When to create a new view?

  1. #1
    Sencha User
    Join Date
    Dec 2014
    Posts
    3

    Default Answered: Best Practices - When to create a new view?

    Hello everyone,

    I am wondering what is the best practice in terms of creating new views. For example, consider the following code:

    Code:
    Ext.application({
        name: 'Sencha',
    
    
        launch: function() {
           
            Ext.create("Ext.tab.Panel", {
                fullscreen: true,
                tabBarPosition: 'bottom',
    
    
                items: [
                    {
                        title: 'Home',
                        iconCls: 'home',
                        cls: 'home',
                        html: [
                            '',
                            'Welcome to Sencha Touch',
                            "We're creating the Getting Started app, which demonstrates how ",
                            "to use tabs, lists, and forms to create a simple app.",
                            'Sencha Touch'
                        ].join("")
                    },
                    {
                        title: 'Contact',
                        iconCls: 'user',
                        xtype: 'formpanel',
                        url: 'contact.php',
                        layout: 'vbox',
    
    
                        items: [
                            {
                                ...
                            }
                        ]
                    }
                ]
            });
        }
    });

    Would it be a good idea to create new views to represent the items from the above? Like this:

    Code:
    Ext.application({
        name: 'Sencha',
    
    
        views: ['Home, Contact'],
     
    
        launch: function() {
           
            Ext.create("Ext.tab.Panel", {
                fullscreen: true,
                tabBarPosition: 'bottom',
    
    
                items: [
                    {
                        xtype: 'home'
                    },
                    {
                        xtype: 'contact"
                    }
                ]
            });
        }
    });

    Thanks for your help.

  2. There are many ways and depend on what you want. Your example is also good. If you want to create a page and push to it, you can try Navigation View, see it in Sencha Touch Docs. Navigation view has push or pop function, and will automatically create back button which helps you back to previous page.

  3. #2
    Sencha User
    Join Date
    Mar 2012
    Posts
    79
    Answers
    6

    Default

    There are many ways and depend on what you want. Your example is also good. If you want to create a page and push to it, you can try Navigation View, see it in Sencha Touch Docs. Navigation view has push or pop function, and will automatically create back button which helps you back to previous page.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •