Results 1 to 2 of 2

Thread: Add html content dynamically to TAB

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Vote Rating

    Default Add html content dynamically to TAB


    I am using ext4js with jquery. I have a Viewport that adds North, East, West,South & Center Panels.

    In the center panel, I am adding the tab panel []. From a jquery button click I am adding a new tab to the tab panel. I am not putting in the html while the tab is created. I am adding after the TAB is created. I find that when the TAB is rendered on the DOM, no TAB contents are visible. Only when I go to another tab and come back to the newly created tab, the tab content is visible. I am unable to understand why this is happening. The code I am using is :

    $('#jquerybutton').bind('click', function () {
    var tab = tabs.add({
    title: 'Tab ' + (tabs.items.length + 1),
    closable: true

    var tabid = + '-body';
    $('#' + tabid).html("TEST CONTENT");

    I know I can use the following tab.add({ html: "<div>Test</div>" })
    But there are other reasons for which I would have to use the way I have done [I am using knockout js and adding widgets to the tab id dynamically]

    Can somebody help me out in this regard. I am stuck for the last 1 day


  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    If you get the component you want to change the html on, use setHtml method on it. You don't need jQuery at all.
    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

    Think my support is good? Get more personalized support via a support subscription.

    Need more help with your app? Hire Sencha Services

    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.

Tags for this Thread

Posting Permissions

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