View Full Version : How to get 'FormPanel.buttons' value

24 Aug 2011, 9:35 PM
I want to "this.formpanel.buttons" Get "button" object, but why not ask?

this.formpanel = Ext.create('Ext.form.Panel', {
url: 'ContactUsPage.aspx',
defaultType: 'textfield',
defaults: { xtype: 'textfield', anchor: '98%' },
{ text: 'Save'},
this.formpanel.buttons = null//Why not here, "buttons" property value?
this.formpanel.form.buttons = typeof Object//Why get here "buttons" property value, and the value of type "Object"

27 Aug 2011, 6:40 AM
During a component's construction it is common to copy the entire config object onto the component. This can result in there being a lot of properties on the component that don't actually do anything. Under normal circumstances you can only rely on a property if it is documented as a public property.

The buttons config option is initially copied across to the component but as it is not used post-config it is subsequently deleted. As it is not documented as a public property there is nothing wrong with this.

I believe the buttons property you see on the underlying form is also a consequence of a config copying process and it doesn't actually have any significance to that form. Indeed its value appears to just be the configs for the buttons and not the buttons themselves.

From reading the documentation:


it seems that the buttons config option is just a shorthand for creating a docked toolbar. One way to access the buttons themselves might be to use component queries:


This will give you an array containing the two buttons. There are many variations on this theme.