Results 1 to 4 of 4

Thread: How to update checkbox box label

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2009
    Posts
    138
    Answers
    1
    Vote Rating
    4
      0  

    Default How to update checkbox box label

    I'd like to update a checkbox box label, ideally using beforeBoxLabelTpl with a data object that can change. I don't quite see how to do this, other than destroying the component and re-creating it. Is that what I need to do?

    Thanks.

  2. #2
    Sencha Premium Member
    Join Date
    Jul 2009
    Posts
    138
    Answers
    1
    Vote Rating
    4
      0  

    Default

    This is one way to do it, but I was just wondering if there is an update method that will accomplish what lines 2-4 of the code below do.

    Code:
            checkbox.subTplData = {yearCost: totalYearPrice, yearSavings: yearSavings};
            checkbox.getEl().down('td[role=presentation]').setHTML(annual.getSubTplMarkup());
    		checkbox.inputEl = annual.getEl().down('input');
    		checkbox.initEvents();
    Last edited by JacobGu; 29 Aug 2012 at 1:25 PM. Reason: code correction

  3. #3
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Answers
    124
    Vote Rating
    93
      0  

    Default

    Hi!
    which Extjs 4 version are you using?

    if you are using 4.1.0 or later, then you may use setFieldLabel()

    check this:-
    http://docs.sencha.com/ext-js/4-1/#!...-setFieldLabel
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  4. #4
    Sencha Premium Member
    Join Date
    Jul 2009
    Posts
    138
    Answers
    1
    Vote Rating
    4
      0  

    Default

    Hi-

    I am using 4.1 and tried your solution of setFieldLabel (and using fieldLabel with labelAlign:'right', instead of boxLabel), but it creates two checkboxes. There's probably some way to get it to work, but since the solution posted in my prior message works and is only 4 lines of code, I decided to stick with it and move on to bigger problems.

    Thanks.

Posting Permissions

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