1. #11
    Sencha User
    Join Date
    Aug 2011
    Location
    Plymouth, UK
    Posts
    137
    Vote Rating
    -2
    simondavies has a little shameless behaviour in the past

      0  

    Default


    The only difference I see with yours and mine is as follows:

    Where you have:

    Code:
    index: function(options) {
            if ( ! this.indexView) {
                this.indexView = this.render({
                    xtype: 'DirectoryIndex',
                });
            }
            this.application.viewport.setActiveItem(this.indexView, options.animation);
    I would just have

    Code:
    index: function() {
            if ( ! this.indexView) {
                this.indexView = this.render({
                    xtype: 'index',
                });
            }
            this.application.viewport.setActiveItem(this.indexView);
    I do not have the "options" and "options.animations" and I also just have "index" where you have "DirectoryIndex"

    This is all i can see at the mo.
    Last edited by simondavies; 3 Nov 2011 at 8:43 AM. Reason: Pressed submit rather than preview so had to add more info

  2. #12
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    yes that strange ;.. i can't call index because in my viewport, i have:
    Code:
    App.views.Viewport = Ext.extend(Ext.Panel, {
        fullscreen: true,
        layout: 'card',
        cardSwitchAnimation: 'slide',
    	dockedItems: [
    	    {
    	    	xtype: 'TabBarMvc',
    	    	items: [
    		        {
    		        	text: App.config._DirectoryTitle,
    		        	iconCls: App.config._DirectoryIconCls,
    		        	route: 'Directory/index',
    		        },
    		        {
    		        	text: App.config._SearchTitle,
    		        	iconCls: App.config._SearchIconCls,
    		        	route: 'Search/index',
    		        }
    	        ]
    	    }
    	]
    });
    Then it's that, Directory/index, i don't know why it doesn't work ...

  3. #13
    Sencha User
    Join Date
    Aug 2011
    Location
    Plymouth, UK
    Posts
    137
    Vote Rating
    -2
    simondavies has a little shameless behaviour in the past

      0  

    Question


    All I have in my viewport is as follows:

    Code:
    App.views.Viewport = Ext.extend(Ext.Panel, {
        fullscreen: true,
        layout: 'card',
        cardSwitchAnimation: 'slide'
    });
    In my main app js file I have:

    Code:
    Ext.regApplication({
        name: "App",
            defaultUrl: 'app/index',
        launch: function() {
                this.viewport = new this.views.Viewport();
        }
    });

    Hope this helps, otherwise if you want to pm or send a zip version of what it is your doing and I can try to have a look etc

    Thanks

  4. #14
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    Yes i have the same ... Just in my Viewport i have 4 views in a bottom toolbar... I don't understand -_-

  5. #15
    Sencha User
    Join Date
    Aug 2011
    Location
    Plymouth, UK
    Posts
    137
    Vote Rating
    -2
    simondavies has a little shameless behaviour in the past

      0  

    Question


    I believe I have solved the issue.


    Firstly please find below the code i added to get this to work:

    Your DirectoryController.js File:

    Code:
    Ext.regController('Directory', {
    
    
        index: function(options) {
            if ( ! this.indexView) {
                this.indexView = this.render({
                    xtype: 'DirectoryIndex',
                });
            }
            this.application.viewport.setActiveItem(this.indexView, options.animation);
            var homeBtn = this.application.viewport.query('#homeBtn')[0];
            homeBtn.setHandler(
                        function(){
                        Ext.redirect('Search/index');
            });
        },
    
    
    });

    Your DirectoryIndexView.js file

    Code:
    App.views.DirectoryIndex = Ext.extend(Ext.NestedList, {    title: App.config._DirectoryTitle,
        store: App.stores.DirectoryIndexStore,
        fullscreen: true,
        singleSelect: true,
        displayField: 'name',
        useTitleAsBackText: false,
        backText: '',
        getItemTextTpl: function() {
            var tplConstructor = loadURL(App.config.host + App.config.DirectoryTPL + 'DirectoryIndex.html');
            return tplConstructor;
        },
        listeners: {
            afterrender: function() {
                this.toolbar.remove(this.backButton);
                this.backButton = new Ext.Button({
                    ui: 'plain',
                    iconMask: true,
                    useTitleAsBackText: false,
                    iconCls: 'arrow_left',
                    scope: this,
                    handler: this.onBackTap
                });
                this.toolbar.add(this.backButton);
            },
            scope: App.views.DirectoryIndex,
        },
        toolbar: {
            componentCls: 'x-toolbar-dark',
            items: [{xtype: 'spacer'},{iconCls: 'home',  iconMask: true, id: 'homeBtn'}],
        },
        
    
    
    });
    Ext.reg('DirectoryIndex', App.views.DirectoryIndex);
    Now the issue I believe is that as you have it on your main controller/home section your already on the home page. (index.html#Directory/index) so in my earlier code that you tried and said that you got it to register an Alert but not goinb back is because to go home I was calling 'Directory/index' within my Ext.redirect('Directory/index') and as we are already on this page its got nowhere else to go.

    I tested this by simply putting another page/view call within the Ext.redirect and it worked fine and opened the search section up. (see above I have used the 'search/index' in the Ext.redirect code)

    try this and you will see the home page works.

    so what you need to do is if you want to call the Directory/index in the code then you need to some how reset it so it loads the first data list from the nested view.

    Hoep this helps

  6. #16
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    Hum yes exactly, thanks, the method works fine .

    Yes it's that, i look for a method able to initialize again my view in fact.
    It's for this reason, i found a solution, consist to destroy the view:
    Code:
    		listeners: {
    	        deactivate: function(this.indexView) {
    	            this.indexView.destroy();
    	        }
    	    },
    But it doesn't work for the moment, i can't implement it... And how to initialize the view again.
    do you know?

  7. #17
    Sencha User
    Join Date
    Aug 2011
    Location
    Plymouth, UK
    Posts
    137
    Vote Rating
    -2
    simondavies has a little shameless behaviour in the past

      0  

    Question


    Hi myput sorry not been intouch, been working on other projects at mo and busy, have you solved this issue yet? Otherwise I will have a look

    Thanks

  8. #18
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    Hey, thanks no problem,

    No i'm trying to remake the application without extern scripts etc ... and for the moment, i have an MVC application with my views but i have a problem for load html and views in render ... I don't know why for the moment.

    Code:
    App.views.Viewport = Ext.extend(Ext.Panel, {
    	id: 'viewport',
    	fullscreen: true,
    	layout: 'card',
    	dockedItems: [
    		new Ext.TabPanel({
    		    fullscreen: true,
    		    layout: "card",
    		    tabBar: {
    		        dock: 'bottom',
    		        layout: {
    		            pack: 'center'
    		        }
    		    },
    		    cardSwitchAnimation: {
    		        type: 'fade'
    		    },
    		    defaults: {
    		        scroll: 'vertical'
    		    },
    			items: [
    				{
    					title: App.config._HomeTitle,
    	        		iconCls: App.config._HomeIconCls,
    					controller: 'Home',
    					action: 'index'
    				},{
    					title: App.config._DirectoryTitle,
    		        	iconCls: App.config._DirectoryIconCls,
    					controller: 'Directory',
    					action: 'index',
    				}
    			],
    			listeners: {
    				cardswitch: function(tabPanel, newCard, oldCard, index, animated) {
    					if(newCard.controller && newCard.action){
    						Ext.dispatch({
    							controller: newCard.controller,
    							action: newCard.action,
    							historyUrl: newCard.controller+"/"+newCard.action,
    							animation: {type:'slide',direction:'left'}
    						});
    					}
    				}
    			}
    		})
    	]
    });
    and the controller for example Home

    Code:
    Ext.regController('Home', {
    
    
    	index: function(options) {
    		this.indexView = this.render({
    			xtype: 'App.views.homeView',
    			listeners: {
    				deactivate: function() {
    					App.views.homeView.destroy();
    				}
    			}
    		});
    		this.application.viewport.setActiveItem(this.indexView, null);
    	}
    	
    });
    when i put an alert before this.indexView = this.render({, the alert is displayed, but i can't display html in this.indexView

    I don't know why for the moment ...

  9. #19
    Sencha User
    Join Date
    Aug 2011
    Location
    Plymouth, UK
    Posts
    137
    Vote Rating
    -2
    simondavies has a little shameless behaviour in the past

      0  

    Question


    Have not had chance to look at this but I suggest as its a new try and error that you post another thread, then others can see this and also helps :-), send a link when done so I can pick it up as well.

    Thanks

  10. #20
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Vote Rating
    1
    myput is on a distinguished road

      0  

    Default


    yep oki thanks

Thread Participants: 1

Tags for this Thread