Search code examples
javascriptextjssencha-touch

Dynamically ItemId in Sencha Touch app


I am working in an app based in Sencha Touch 2, and I have different buttons with the possibility of different badge text. My current code in the view is:

items: [
            {
                xtype: 'button',
                text: xx.Text.getText('SC_I_CONDITIONS_BTN'),
                itemId: 'setItemConditions',
                cls:'setConditions'
            }
        ],

My question is, how can I specify different badge texts? Each one has different total, in my app you can generate different buttons dinamically with the same itemID

Thanks a lot!!


Solution

  • I think you want to set badge text dynamically first get button in controller like that

    Ext.getCmp("setItemConditions").setBadgeText('newBadgeText');