Results 1 to 5 of 5

Thread: Change item labels on-the-fly

  1. #1
    Sencha Premium Member
    Join Date
    Aug 2008
    Posts
    209
    Answers
    4
    Vote Rating
    4
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      0  

    Default

    Great thanks. Got it to work!

Posting Permissions

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