Results 1 to 4 of 4

Thread: Toolbar bug?

  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2007
    Posts
    2

    Default Toolbar bug?

    I would like to disable or hide the toolbar items. With the code above, only the event beforerender is executed and the items count is 0. How i can check all the items?

    Code:
    new Ext.Toolbar({
    	items:[{
    		id: "titem-add",
    		text:'Add Button',
    		handler: Ext.emptyFn
    	       }, "-", {
    		id: "titem-other",
    		text: 'Other Button', 
    		handler: Ext.emptyFn
    	       }],
    	listeners:{
    		beforeshow: function(toolbar){
    			console.log("beforeshow", toolbar.items.getCount());
    		},
    		beforerender: function(toolbar){
    			console.log("beforerender", toolbar.items.getCount());
    		}
    	}
    })
    Thank's in advance.

  2. #2
    Ext User para's Avatar
    Join Date
    Apr 2007
    Location
    Redmond, WA
    Posts
    918

    Default

    beforeshow and beforerender aren't what you need.

    You want to check the items?

    If you want to disable the items by default, then you can used the 'disabled' config set to true on the individual items.

    If you want to go through a list of rendered items, use the 'render' event. (can be thought of as 'afterrender')

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2007
    Posts
    2

    Default Toolbar items...

    My principal problem is access to items, because toolbar.items.getCount() is 0, in all events. How I can go through a list of rendered items?

    Thanks...

  4. #4
    Ext User para's Avatar
    Join Date
    Apr 2007
    Location
    Redmond, WA
    Posts
    918

    Default

    Even using the 'render' event?

    Are you sure you're looking at the right toolbar? Maybe assign an id to the toolbar and use Ext.getCmp('toolbarid').items.getCount()

    What's the endgame here? You want to iterate through, right when it's created? Or at user-action specified times? (ie the user does something that triggers the items to be disabled)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •