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

      0  

    Exclamation Answered: How to get 'FormPanel.buttons' value

    Answered: How to get 'FormPanel.buttons' value


    I want to "this.formpanel.buttons" Get "button" object, but why not ask?
    Code:
    this.formpanel = Ext.create('Ext.form.Panel', {
                //title:this.title,
                frame:true,
                url: 'ContactUsPage.aspx',
                defaultType: 'textfield',
                defaults: { xtype: 'textfield', anchor: '98%' },
                buttons:[
                    { text: 'Save'},
                    {text:'Return'}
                ]
            });
    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"

  2. 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:

    http://docs.sencha.com/ext-js/4-0/#!...el-cfg-buttons

    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:

    Code:
    this.formpanel.getDockedItems('toolbar[dock=bottom]')[0].query('button');
    This will give you an array containing the two buttons. There are many variations on this theme.

  3. #2
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Answers
    498
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    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:

    http://docs.sencha.com/ext-js/4-0/#!...el-cfg-buttons

    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:

    Code:
    this.formpanel.getDockedItems('toolbar[dock=bottom]')[0].query('button');
    This will give you an array containing the two buttons. There are many variations on this theme.

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar