1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    13
    Vote Rating
    0
    oswaldo.gh89 is on a distinguished road

      0  

    Default Unanswered: Passing parameters. Between views, using controller

    Unanswered: Passing parameters. Between views, using controller


    I have two views of which the first is a list that is charged by a store,then I have to pass the ID selected, on the second view, which is also a list, but using the Store requires the ID of the previous view to load the data correctly.

    FIRST VIEW
    Code:
    
    
    Code:
    Ext.define('TEST.view.Place',{
        extend: 'Ext.navigation.View',
        requires:[
            'Ext.plugin.PullRefresh',
            'Ext.field.Select',
            'Ext.form.FieldSet',
            'Ext.field.Email'
        ],
        xtype: 'place',
        title: 'mundo',
        
        
        config:
        {
            title: 'HOME',
            iconCls: 'home',
            navigationBar: false,
            items:[
                {
                        xtype: 'list',
                        itemTpl: '<h1><img alt="" src="Logos/{logo}.png" style="width: 10px; height: 10px; " /><strong> {name}: ({count})</strong><br /><span style="color:#a9a9a9;"><span style="font-size: 11px; ">{description}: </span></span></h1>',
                        id: 'first',
                        title: 'Place',
                        listeners: {
                            select: function(view, record) {
    
    
                            }
                        },
                        store: 
                        {
                            autoLoad: true,
                            fields: ['id','name','description','logo','count'],
                            proxy: 
                            {
                                type: 'ajax',
                                url: 'ci/index.php/places/showpeopleatplace',
                                reader: 
                                {
                                    type: 'json',
                                    rootProperty: 'rows'
                                }
                            }
                        },
                        plugins: [
                            {
                                xclass: 'Ext.plugin.PullRefresh',
                                pullRefreshText: 'Pull down for more new Places!'
                            }
                        ],
                },
                {
                    xtype: 'toolbar',
                    docked: 'top',
                    title: 'TEST',
                }
            ]
        }
    });
    The second view is not yet loaded with the store, why not find a way to pass the parameter from the first sight, but this would be the idea


    html: '<img src="userAtPlace/14.jpg"> Loaded statically.
    html: '<img src="userAtPlace/+Parameter1+.jpg"> dynamically loaded.


    SECOND VIEW
    Code:
    
    
    Code:
    Ext.define('TEST.view.PeopleAtPlace',{
        extend: 'Ext.navigation.View',
        requires:[
            'Ext.plugin.PullRefresh',
            'Ext.field.Select',
            'Ext.form.FieldSet',
            'Ext.field.Email'
        ],
        xtype: 'peopleAtPlace',
        config:
        {
            title: 'People at Place',
            navigationBar: false,
            items: [
                {
                        xtype: 'dataview',
                        id: 'second',
                        html: '<img src="userAtPlace/14.jpg" align="left"; style="width: 106px; height: 120px; "/>',
                        plugins: [
                            {
                                xclass: 'Ext.plugin.PullRefresh',
                                pullRefreshText: 'Pull down for more new Places!'
                            }
                        ],
                },
                {
                    xtype: 'toolbar',
                    docked: 'top',
                    title: 'People At Place',
                }
            ]
        }
    });


    This is the controller that launches the second view
    CONTROLLER
    Code:
    
    
    Code:
    Ext.define('TEST.controller.Main', {
        views: ['Main','Place','Loginfb','Preferences','AddPlace','PeopleAtPlace'],
        extend: 'Ext.app.Controller',
        
        config: {
    
    
            refs: {
                place: 'place'
            },
            control: {
                
                'place list' :
                {
                    itemtap: 'first'
                }
            }
        },
        first: function() {
            Ext.Viewport.setActiveItem(Ext.create('TEST.view.PeopleAtPlace'));
        }
    });
    I hope I can help, and sorry if my English is bad, I'm Mexican and I'm new to this of sencha, but I have really wanted to learn. Thanks in advance.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,731
    Answers
    3362
    Vote Rating
    754
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    When you create the view, it is best to handle the config..

    Code:
    Ext.create('MyView', {
        config1 : 'foo'
    });
    
    Ext.define('MyView', {
        //....
    
        config : {
            //....
            config1 : null
        },
    
        updateConfig1 : function(config1, oldConfig1) {
            //do something with it here
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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