1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    31
    Vote Rating
    0
    eilijah is on a distinguished road

      0  

    Default 2 button problems with navigation view

    2 button problems with navigation view


    Hello,

    I have a navigation view containing a simple view. I have a button "Next" in the navigation bar which push new simple view using his xtype. This new view have a simple button with an id. I have a controller which on this button tap execute an Ext.Msg.alert. This works on the first try, but when i come back on the first page, then come back again on the 2nd and finally repress the button, nothing appears. the event seems to be ignored.
    Here 4 simple classes which reproduce my app :
    Code:
    Ext.define('Test.controller.Test', {	extend: 'Ext.app.Controller',
    
    
    	config: {
    
    
    		refs: {
    			container: 'main',
    			nextBtn: '#next_btn',
    			alertBtn: '#alert_btn',
    
    
    		},
    		control: {
    			nextBtn: {
    				tap: 'onNextBtnTap'
    			},
    			alertBtn: {
    				tap: 'onAlertBtnTap'
    			},
    		}
    	},
    
    
    	onNextBtnTap : function() {
    		this.getContainer().push({
    			xtype: 'page_2',
    			title: 'step 2/2'
    		});
    	},
    
    
    	onAlertBtnTap : function() {
    		Ext.Msg.alert('alert btn pressed');
    	},
    
    
    });
    Code:
    Ext.define('Test.view.Main', {    extend: 'Ext.navigation.View',
        alias: 'widget.main',
        xtype: 'main',
    
    
        requires: [
                'Test.view.Page1'
        ],
        
        config: {
            navigationBar: {
                items: [
                    {
                        xtype: 'button',
                        id: 'next_btn',
                        ui: 'forward',
                        text: 'OK',
                        align: 'right'
                    }
                ]
            },
            items: [
                {
                    xtype: 'page_1'
                }
            ]
        },
    });
    Code:
    Ext.define('Test.view.Page1', {    extend: 'Ext.form.Panel',
        alias: 'widget.page_1',
    
    
        config: {
    		  title: 'step 1',		
    		  html: "step 1"
        },
    });
    Code:
    Ext.define('Test.view.Page2', {    extend: 'Ext.form.Panel',
        alias: 'widget.page_2',
    
    
        config: {
    		title: 'step 2',		
    		items: [
    			{
                xtype: 'button',
                margin: '10 0 0 0',
                text: 'alert',
                id: 'alert_btn'
    			},
    		]
            
        },
    });

    I'm using a similar navigation in the app i am working on, having 5 views in the wizard. My second problem is that on Iphone, using latest cordova, when i reach the 2nd view the back button have a bigger size than usual (like 30% of the navbar width). I didnt even touched the button but still it's bigger, and when i go on the 3rd page which have normal button and come back (so pop the 3rd), the button of the 2nd suddently just come back to normal size.


    Any idea what is happend and how to resolve these isues please?

  2. #2
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    93
    Vote Rating
    2
    bwags is on a distinguished road

      0  

    Default


    I've seen this...my guess is it's some kind of id collision Sencha doesn't deal well with. If you make your component query more specific, like
    nextBtn: 'main #next_btn',
    I'll bet you get it cleared right up.

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    31
    Vote Rating
    0
    eilijah is on a distinguished road

      0  

    Default


    Thank you for your answer, sadly it doesn't works better.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Vote Rating
    814
    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


    Don't use the id config, refs won't listen to it after you destroy and create it again
    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.

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    31
    Vote Rating
    0
    eilijah is on a distinguished road

      0  

    Default


    I've got id's all over the app!! Ext.getCmp() is pretty usefull when getting into obscure scopes.

    Ill check that closer, thanks for the explanation !

    Any guess about the back button changing his own width on iphone?

Thread Participants: 2

Tags for this Thread