1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    52
    Answers
    3
    Vote Rating
    1
    jvwelzen is on a distinguished road

      0  

    Default Unanswered: how to use setActiveItem

    Unanswered: how to use setActiveItem


    Hi all

    I have a Ext.tab.Panel en want to slide to another tab using setActiveItem

    But I can't get it to work

    this is my page that i am working on

    Code:
    Ext.define("ListItem1", {extend: "Ext.data.Model",
                    fields: [
    		{name: 'id'},
            	{name: 'created_at'},
            	{name: 'source'},
    		{name: 'text'},
    		{name: 'name', mapping: 'user.name.substring(0,62);'},
    		{name: 'profile_image_url', mapping: 'user.profile_image_url'}
    		
        ]
            });
    
    
            var store = new Ext.data.Store({
                model: 'ListItem1',
    	    storeId: 'store',
                autoLoad: true,
                pageSize: 500,
                clearOnPageLoad: true,
                proxy: {
                    type: 'ajax',
                    url: 'http://www.hws-koeriers.nl/hws/flex/home.php',
                    reader: {
                        //root: 'profile',
                        type: 'json'
                    },	
    
    
                    extraParams: {
                        rpp: 500,
                        suppress_response_codes: true
                    	}
                },            
    	    timeout: 2000,
                listeners: {
                    exception:function () {
                        console.log("I think we are offline");
                       
                        storeOffline.load();
                    }
    
    
                }
    		//listeners: {
    
    
                    //load: function() {
    
    
                        // Clear proxy from offline store
                        //storeOffline.proxy.clear();
    
    
                        // Loop through records and fill the offline store
                        //this.each(function(record) {
    
    
                           // storeOffline.add(record.data);
    			
    
    
                        //});
    
    
                        // Sync the offline store
                        //storeOffline.sync();
    
    
                        // Remove data from online store
                        //store.removeAll();
    
    
                    ///}
    
    
                //}
    
    
            });
    
    
    
    
    
    
        var storeOffline = new Ext.data.Store({
            model: "ListItem1",
            storeId: 'ListItem1',
    	autoLoad: true,
            pageSize: 500,
            proxy: {
                type: 'localstorage',
                id: "ListItem1"
            },
                    extraParams: {
                        rpp: 500,
    		}
        });
    
    
    
    
    
    
    Ext.define('rpc.view.home.HomePage', {
        extend: 'Ext.List',    
        alias: 'widget.homepage',
        config: {    
    	//emptyText: '<div class="x-mask-inner"><div class="x-loading-spinner-outer"><div class="x-loading-spinner"><span class="x-loading-top"></span><span class="x-loading-right"></span><span class="x-loading-bottom"></span><span class="x-loading-left"></span></div></div><div class="x-mask-msg" id="ext-element-33">Loading...</div></div>',
    	//itemTpl: '<div id={id}><div id=topheader><div id=left><img id=avatar src={profile_image_url}></div><div id=right><b>{name}</b></div></div><div id=middle>{text:this.linkify}</div><div id=bottom>{created_at} via {source}</div></div>',
    	itemTpl: new Ext.XTemplate(
                    '<div id=topheader><div id=left><img id=avatar src="{profile_image_url}" /></div>',
    
    
                    '<div id=right><b>{name}</b></div></div>',
    
    
                        '<div id=middle>{text:this.linkify}</div>',
                            '',
                            
                            '<div id=bottom>{created_at} via {source}</div>',
                        '',
                    '',
                    {
                        linkify: function(value) {
                            //return value.replace(/(http:\/\/[^\s]*)/g, "$1");
    			return value.replace(/(http:\/\/[^\s]*)/g, "<a target=\"_self\" href=\"$1\">$1</a>");
                        }
                    }
                
                ),
    	    allowDeselect: false,
                disclosure: false,
    
    
    	store: storeOffline,
    
    
                onItemDisclosure: {
                    scope: 'this',
                    handler: function(record, btn, index) {
                        alert('Disclose more info for ' + record.get('name'));
    		    rpc.view.home.Viewport.setActiveItem('webpage');
    
    
                    }
                }, 
    
    
        	items: [
            {
                xtype : 'toolbar',
                docked: 'top',
                title: 'Timeline'
            }],
    
    
        },
    
    
        initialize: function() {
            console.log("InitComponent for homepage"); 
    	//store.load();     
            this.callParent();  
        },
               
                 onItemTap: function() {
    		
                    rpc.view.home.Viewport.setActiveItem('webpage');
                    
                }
               
    });
    
    
    this.store.addListener('load', function () {
        console.log("I think we are online");
        //storeOffline.proxy.clear();
        this.each(function (record) {
            storeOffline.add(record.data);
    	//console.log(record.data);
        });
        storeOffline.sync();
        
    });
    any idea

    thanks in advance

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Answers
    93
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    I don't see where you are adding your view to the viewport? Or where your TabPanel is?
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    52
    Answers
    3
    Vote Rating
    1
    jvwelzen is on a distinguished road

      0  

    Default


    The tab panel is in app.js

    Code:
    Ext.Loader.setConfig({enabled: true});
    
    
    
    
    
    
    Ext.application({
        name: 'rpc',
        id: 'rpc',
        appFolder: 'app',           
        controllers: ['Home'],
    
    
        launch: function () {
    
    
            Ext.create('Ext.tab.Panel',{
    		id: 'panel',
                fullscreen: true,          
                tabBarPosition: 'bottom',
                items:[{
                    title: 'Home',
                    iconCls: 'home',
                    xtype: 'homepage',
    		listeners: {   
    		activate : function(){ 
    			//store.load();
    			//console.log("help");
    			//storeOffline.update();
    			//panel.setActiveItem('card2', {type:'pop', direction:'left'});
    			}
    		}  
                },{
                    title: 'Mentions',
                    iconCls: 'at',
                    xtype: 'composepage',
    		listeners: {   
    		activate : function(){ 
    			//store1.load();
    			//console.log("help");
    			//store1Offline.update();
    			
    			}
    		} 
                },{
                    title: 'WebPage',
                    iconCls: 'web',
                    xtype: 'webpage',
    		listeners: {   
    		activate : function(){ 
    			//store1.load();
    			//console.log(this);
    			//store1Offline.update();
    			//this.setActiveItem('webpage', {type:'slide', direction:'left'});
    			}
    		} 
                }]
        
            });     
        }
    
    
    });

    if I use this.setActiveItem("webpage");

    Then the page becomes active but it's renderd at the bottom of the page

    I also saw another tread in the forum with the same problem saying that it was a bug en will be fixed in the next release ..

  4. #4
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Answers
    93
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    As far as I know, setActiveItem has never supported a component query string, which you are using. You either need an id, reference to an instance of the view you want to activate, or a number.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi