1. #21
    Ext JS Premium Member NoahK17's Avatar
    Join Date
    Apr 2008
    Location
    Atlanta, GA
    Posts
    518
    Vote Rating
    1
    NoahK17 is on a distinguished road

      0  

    Default


    Can't you just use xtype:'button', and isFormField:true in the config and have it show up properly in a form? This works for me!

    Code:
    {
        fieldLabel: 'Select Columns',
        text: 'Choose...',
        xtype:'button',
        id: 'grid-col-menu',
        menu: this.colMenu,
        iconCls: 'icon-cols',
        isFormField:true
    }
    Noah
    Senior Web Developer
    NBA.com

  2. #22
    Sencha User
    Join Date
    Apr 2008
    Posts
    365
    Vote Rating
    0
    wuschba is on a distinguished road

      0  

    Default


    You are right: isFormField:true seems to work. Is it "allowed" to use it since it's not declared as public in the API-Docs?

  3. #23
    Ext JS Premium Member NoahK17's Avatar
    Join Date
    Apr 2008
    Location
    Atlanta, GA
    Posts
    518
    Vote Rating
    1
    NoahK17 is on a distinguished road

      0  

    Default


    I mean, you can use whatever function or "config" option that's available in the source. Just because it's not public, doesn't mean it isn't useful

    See, there's an if statement that checks if "isFormField" is true ... with buttons, that config option is undefined, so the appropriate CSS is not applied to the button, mainly dealing with the fieldLabel config... so if you manually add in "isFormField:true" to your button config, it is properly displayed in your form with a fieldLabel and everything.

    Cheers!
    Noah
    Senior Web Developer
    NBA.com

  4. #24
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    Quote Originally Posted by wuschba View Post
    You are right: isFormField:true seems to work. Is it "allowed" to use it since it's not declared as public in the API-Docs?
    a general rule-of-thumb would be to take care when using / overriding code that's not in any API -- since they're not documented, their interfaces are not guaranteed to remain constant between versions, so you'll have to ensure these don't break between upgrades.

  5. #25
    Ext JS Premium Member NoahK17's Avatar
    Join Date
    Apr 2008
    Location
    Atlanta, GA
    Posts
    518
    Vote Rating
    1
    NoahK17 is on a distinguished road

      0  

    Default


    I would love to see Button be usable with a fieldLabel without using an undocumented hack in a future version. Any chance?
    Noah
    Senior Web Developer
    NBA.com

  6. #26
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    In Ext 2.2, FormLayout will render any Component configured with a fieldLabel config looking like a Form Component.

    So a standard Ext.Button can be added to a FormPanel with a fieldLabel.

  7. #27
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    ^^ There are quite a few things that are OOTB in Ext 2 that I will pull out my custom code for. Like Grouping radios

  8. #28
    Sencha User
    Join Date
    Apr 2008
    Posts
    15
    Vote Rating
    0
    VinceChen is on a distinguished road

      0  

    Default


    Dear Animal, But I don't see a "fieldLabel" config declaration of Ext.Button in Ext 2.2 API documentation. And I try to use "fieldLabel" config in my code, it doesn't appear as prior Ext 2.1 and Ext 2.0.x library.

  9. #29
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    I will add fieldLabel as a config option to Ext.Component. But it will only take effect when rendered by a FormLayout or subclass of FormLayout. The docs wil mention this, but people don't read them properly, and we'll get forum threads saying "Why don't my field labels show up?"

  10. #30
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Ach! The code to test for fieldLabel is in the 3.0 branch and not the 2.2 branch, so it won't work yet! That's a bit of a mismatch in modification procedure by Jack (or whoever authored that fix). The change should have gone into both branches.

    Oh well. I'll update the doc comments in the 3.0 branch.