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

      0  

    Default Unanswered: Bug in initialization of nestedlist

    Unanswered: Bug in initialization of nestedlist


    Hello,
    I have a bug in my nestedList initialization of the nestedlist with my backButton:
    i have a listener because i change the backbitten for a new one in my nestedlist;


    The problem is when i launch the application, when i'm coming in the panel nestedlist (because the viewport is a tabPanel), the backButton is in the first floot of the nestedlist… fortunately It doesn't work. After when i navigate in my nestedlist and come back to the first floor, the button is not here, like normal nestedlist. When i change of viewport card and come back, it's the same, normal configuration, the button is not here.


    this is the code of the nestedList:
    Code:
    	listeners: {
    		afterrender: function() {
    			this.toolbar.remove(this.backButton);
    			this.backButton = new Ext.Button({
    				ui: 'plain',
    				iconMask: true,
    				useTitleAsBackText: false,
    				iconCls: App.config._AppBackButton,
    				scope: this,
    				handler: this.onBackTap
    			});
    			this.toolbar.add(this.backButton);
    		}
    	},
    i tried with:
    Code:
    			while (this.items.indexOf(this.getActiveItem()) > 0) {
    				alert("pass");
    				this.toolbar.add(this.backButton);
    			}
    but no success ...


    The bug is just when i open the application.
    How can i fix it please?

    thanks by advance

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,546
    Vote Rating
    873
    Answers
    3566
    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


    Let's look at this architecturally... NestedList extends Panel that uses CardLayout and each card is an Ext.List. So to hide/show the back button, you can listen for the cardswitch event on the NestedList which the 4th argument of that event is the index. If the index is zero, hide the back button else show it. On your button, you need to have hidden : true at the start.

    Since you didn't go the route of updating the CSS to just change the UI.
    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.

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

      0  

    Default


    Yes i tried:
    Code:
    app.views.myNestedList = new Ext.NestedList({ .........
    listeners : {        afterrender: function(app.views.myNestedList) {
                var button = app.views.myNestedList.down('backButton');
                button.el.replaceCls('x-button-back', 'x-button-plain');        }    }
    but it doesn't work ...I don't don't know how to change simply the backbutton of the nestedList

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,546
    Vote Rating
    873
    Answers
    3566
    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


    Why do you do this:

    Code:
    app.views.myNestedList.down('backButton');
    when you can do

    Code:
    this.backButton
    Code:
    app.views.myNestedList.down('backButton');
    is expecting to find an xtype of 'backButton' which it will not find.
    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
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Vote Rating
    1
    Answers
    16
    myput is on a distinguished road

      0  

    Default


    hum, yes i tried:
    Code:
    App.views.DirectoryNestedList = new Ext.NestedList({
    	title: App.config._DirectoryTitle,
        fullscreen: true,
        store: App.stores.DirectoryNestedListStore,
    	singleSelect: true,
    	displayField: 'name',
    	useTitleAsBackText: false,
    	backText: '',
    	listeners : {
    		afterrender: function(nestedlist) {
    			var button = this.backButton.down();
    			button.replaceCls('x-button-back', 'x-button-plain');
    		}
    	}
    });
    But no success ...
    Have you an Idea?

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,546
    Vote Rating
    873
    Answers
    3566
    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


    That's because you aren't doing it correctly... just tried this on the Nested List example in ST 1.1.1:

    Code:
                listeners: {
                    afterrender: function(list) {
                        var backBtn = list.backButton;
    
                        backBtn.el.replaceCls('x-button-back', 'x-button-plain');
                    }
                }
    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.

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

      0  

    Default


    Yes, okey, i understand the problem.

    I tried with the nestedlist Example and it's working.
    But my nestedlist is inside a TabPanel from the viewport.
    a panel called by item from the viewport add the nestedlist:
    Code:
    App.views.DirectoryPanel = Ext.extend(Ext.Panel, {
    	listeners:{
    		beforeactivate : function(panel) {
    			panel.add(App.views.DirectoryNestedList);
    		},
    	}
    });
    and the nestedList:
    Code:
    App.views.DirectoryNestedList = new Ext.NestedList({
    	title: App.config._DirectoryTitle,
            fullscreen: true,
            store: App.stores.DirectoryNestedListStore,
    	singleSelect: true,
    	displayField: 'name',
    });
    And in the nestedlist, if i do the same code of the nestedlist in the viewport, it's creating me the bug, the nestedlist is not add....

    It can be a bug?
    or there is a way for that ?

    thanks

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

      0  

    Default


    up please

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

      0  

    Default


    It can be a bug?
    Just because the tabPanel, i have the same Nestedlist and it's ok for one without the tabPanel and not with ... ??

    Somebody tested it and have the same problem?

    Thanks for help

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

      0  

    Default


    up please

Thread Participants: 1