1. #11
    Ext JS Premium Member
    Join Date
    Mar 2008
    Location
    Germany, Frankfurt
    Posts
    142
    Vote Rating
    1
    enpasos is on a distinguished road

      0  

    Default


    Any answer for ExtJS4 ??

  2. #12
    Ext JS Premium Member
    Join Date
    Sep 2009
    Posts
    29
    Vote Rating
    2
    allardp is on a distinguished road

      0  

    Default possible solution

    possible solution


    I finally resolved to changing the HTML in the DOM directly, the only way I got it working was

    Code:
            chkboxfld.el.dom.firstChild.lastChild.innerHTML = "new label";
    But why is there no setLabel() method for a checkbox...? For any field in a form this should be a standard function..

  3. #13
    Ext JS Premium Member bregard's Avatar
    Join Date
    Jul 2008
    Posts
    26
    Vote Rating
    0
    bregard is on a distinguished road

      0  

    Default


    Quote Originally Posted by allardp View Post
    I finally resolved to changing the HTML in the DOM directly, the only way I got it working was

    Code:
            chkboxfld.el.dom.firstChild.lastChild.innerHTML = "new label";
    But why is there no setLabel() method for a checkbox...? For any field in a form this should be a standard function..
    This is working for me, but there should definitely be standard methods for this.

  4. #14
    Ext JS Premium Member
    Join Date
    Apr 2008
    Posts
    381
    Vote Rating
    41
    rich02818 is an unknown quantity at this point

      0  

    Default


    Quote Originally Posted by bregard View Post
    This is working for me, but there should definitely be standard methods for this.
    +1

    The current approach is obviously tightly coupled to the current low level implementation and at risk of breaking in future versions.

  5. #15
    Sencha Premium Member
    Join Date
    Jul 2010
    Location
    Italy
    Posts
    9
    Vote Rating
    0
    raiworld81 is on a distinguished road

      0  

    Question Re

    Re


    maybe this is better:
    var ckb = this.query('checkboxfield')[0]
    ckb.boxLabelEl.dom.childNodes[0].nodeValue

  6. #16
    Ext JS Premium Member
    Join Date
    Oct 2011
    Location
    Paris
    Posts
    2
    Vote Rating
    0
    legalbox is on a distinguished road

      0  

    Default ExtJS 4

    ExtJS 4


    In ExtJS 4, this seems to work:
    Code:
    checkbox.getEl().down('.x-form-cb-label').update(newText);

  7. #17
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    Chrischan is on a distinguished road

      0  

    Default


    I think this would be currently the best solution in ExtJS 4:

    Code:
    checkbox.boxLabelEl.update(newLabelText);
    But there is a problem with sizing. If the new text is wider than the old one, the label element will not be resized which leads to an ugly line break. What would be the right way to force recalculating the width? checkbox.doComponentLayout() respectively doLayout() or doComponentLayout() of the ownerCt does not work. Has anyone an idea?

    Apart from that a method like setBoxLabel() would be really nice.

    I've tested it with a radio field instead of a checkbox. Do they behave different (their box label logic doesn't inherit from a common class).

  8. #18
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    36
    Vote Rating
    0
    dipakbhimani is on a distinguished road

      0  

    Default


    I am also facing the same issue.

    I am looking to write generic utility to set the fieldLabel for all the control type like checkbox,radio,textbox, etc.

    Can some one let me know how can I do that ?

    For textbox - getfieldLabel and setFieldLabel() working fine.

    Dipak

  9. #19
    Sencha User
    Join Date
    Jan 2013
    Posts
    1
    Vote Rating
    0
    Misteris is on a distinguished road

      0  

    Default


    Use:
    checkbox.el.down('.x-form-cb-label').update('Your box label');

  10. #20
    Sencha User
    Join Date
    Apr 2012
    Posts
    74
    Vote Rating
    2
    url is on a distinguished road

      0  

    Default


    Try with

    Ext.get('idOfBoxEl').dom.innerHTML = 'NewLabel'

    Regards
    URL