1. #1
    Sencha Premium Member
    Join Date
    Aug 2008
    Posts
    209
    Answers
    4
    Vote Rating
    4
    squarefan is on a distinguished road

      0  

    Default Answered: Change item labels on-the-fly

    Answered: Change item labels on-the-fly


    hi@all

    is there a predefined method or way available in touch 2 that makes it possible to change the label text on-the-fly.

    I would like to update a couple of textfield labels (within a formpanel) and the labels of the main tabs in a tabpanel...

    Updating the values directly does not work e.g.:
    Code:
    Ext.ComponentManager.get('id')._label = 'Test';
    I found some threads from Touch 1 but these methods don't work anymore.

    Any ideas? Thans!

  2. For tabpanel you can loop through it's items and set the title property and use setTitle method on the tab instance that is cached on the item as the tab property.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Answers
    3500
    Vote Rating
    853
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Each config will more than likely have a set method and you should use this set method instead of editing properties directly.

    Fields should have a setLabel method which you can execute passing in a string.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha Premium Member
    Join Date
    Aug 2008
    Posts
    209
    Answers
    4
    Vote Rating
    4
    squarefan is on a distinguished road

      0  

    Default


    @Mitchell

    thanks for the quick reply. Sorry I must have overlooked that in the DOCS (time for a break I guess)- works like charm on textifeld, selectfield etc.

    As for the Tabpanel, I cannot find a method to set it directly (e.g. setLabel) - would be great if I could just pass an array to the tabpanel to update all the tab labels. Looking into the docs I cannot really find any method that allows me to update the tabs ... but maybe I am overlooking something.

    Would be great if you could point me into the right direction... thanks!

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Answers
    3500
    Vote Rating
    853
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    For tabpanel you can loop through it's items and set the title property and use setTitle method on the tab instance that is cached on the item as the tab property.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha Premium Member
    Join Date
    Aug 2008
    Posts
    209
    Answers
    4
    Vote Rating
    4
    squarefan is on a distinguished road

      0  

    Default


    Great thanks. Got it to work!

Thread Participants: 1