1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    172
    Answers
    7
    Vote Rating
    -10
    glafrance is infamous around these parts glafrance is infamous around these parts

      0  

    Default Unanswered: Label setText() working, but in UI text is not updated.

    Unanswered: Label setText() working, but in UI text is not updated.


    I'm using ExtJS 4.0.7 and I have code that uses setText() to change the text of a label.

    But after I call setText(), although Chrome dev tools indicates the text has been changed, the UI does not reflect the change.

    What should I do?

    Thanks in advance.

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,098
    Answers
    113
    Vote Rating
    96
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    try component.doLayout() after using component.setText() or refreshing the view of the panel containing that field.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    172
    Answers
    7
    Vote Rating
    -10
    glafrance is infamous around these parts glafrance is infamous around these parts

      0  

    Default


    Label does not have doLayout() and calling doLayout() on its container does not work.

    Anyone else?

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,010
    Answers
    668
    Vote Rating
    460
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    If you upgrade to 4.1.1 (Highly recommended), you could use:

    Code:
    var form = Ext.create('Ext.form.Panel', {
        title: 'Contact Info',
        width: 300,
        bodyPadding: 10,
        renderTo: Ext.getBody(),
        items: [{
            xtype: 'textfield',
            name: 'name',
            fieldLabel: 'Name',
        }]
    });
    
    var fld = form.down('textfield');
    fld.setFieldLabel('New Name');
    ‚Äč
    Scott.

  5. #5
    Sencha User
    Join Date
    Oct 2011
    Posts
    172
    Answers
    7
    Vote Rating
    -10
    glafrance is infamous around these parts glafrance is infamous around these parts

      0  

    Default


    setText() is working now. I think I was trying to use myLabel.text = "new text" which seemed to work, but did not get refleshed. setText() works now.

  6. #6
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,010
    Answers
    668
    Vote Rating
    460
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Correct. You must use a method to update and not a property.

    Scott.

Thread Participants: 2