Results 1 to 5 of 5

Thread: Button html is deprecated so how do you add html?

Hybrid View

Previous Post Previous Post   Next Post Next Post
    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1235 in a recent build.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Vote Rating
    0
      0  

    Question Button html is deprecated so how do you add html?

    The "html" method on Button is now deprecated in favor of "text" in PR2 and PR3. So, how do you add HTML code to a button???

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,159
    Vote Rating
    7
      0  

    Default

    setText should still accept HTML.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by rdougan View Post
    setText should still accept HTML.
    Doesn't work. Can you move this to the bug forum?

    Code:
    Ext.application({
        name: '2.0 PR3 Form Test',
    
    
        launch: function() {
            console.log('launch:');
    
    
            var myPanel = Ext.create("Ext.Panel", {
                fullscreen: true,
                layout: 'fit',
                items: [
                {
                    xtype: 'container',
                    items: [
                    {
                        xtype: 'button',
                        text: '<div>test</div>'
                    }
                    ]
                }
                ]
            });
            console.log('myPanel=' + myPanel);
    
    
        }
    });

  4. #4
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,159
    Vote Rating
    7
      0  

    Default

    Fixed for the next release.

    You can apply this override to your code to make it work until then:

    Code:
    Ext.define('Ext.overrides.button.updateHtml', {
        override: 'Ext.Button',
    
        updateHtml: function(html) {
            var element = this.textElement;
    
            if (html) {
                element.show();
                element.update(html);
            }
            else {
                element.hide();
            }
        }
    });
    When you use 'html', it will still say in the console that it is deprecated, but ignore that. This will work.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  5. #5
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Vote Rating
    0
      0  

    Default

    Thanks. The patch worked.

Posting Permissions

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