[CLOSED] Update TabPanel content without activating

  1. #1

    [CLOSED] Update TabPanel content without activating

    Hi,
    I need an urgent help on this... In the following example, I add a tab on click of button, but do not activate it.
    Now in FF or IE, if I update body the panel inside tab with
    "Ext.getCmp("panel4").body.update("Dummy");

    I get an error saying panel 4 not defined.

    But if I once activate the Tab, and then update the panel, I have no issues. I need to update content without activating the tab.

    If I check in firebug, under DOM tab, I can see panel4 in the list... But it does'nt update the content...

    Also, this happens only when u have newly added, if once its activated, then I can update even when other tab is active.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
     
     <script language="javascript" type="text/javascript">
         var createTab = function () {
             tab = chatTabs.add({
                 id: 'tab5',
                 title: 'tab5',
                 autoScroll: true,
                 closable: true,
                 bodyStyle: { "position": "relative" },
                 items: [{ id: 'panel4', html: 'Panel1', xtype: 'panel',border:false, style: {
                     position: 'absolute',
                     bottom: '5px',
                     left: '5px'
                     
                 }
                 } ]
             });
             
         }
     </script>
    </head>
    <body>
       <form id="form1" runat="server">
       <ext:resourcemanager runat="server" ID="scp1" DirectMethodNamespace="DM"  >
       
       </ext:resourcemanager>
       <ext:Button ID="btn" Text="Add Tab" runat="server">
       <Listeners>
       <Click Handler="createTab();" />
       </Listeners>
       </ext:Button>
       
       <ext:TabPanel runat="server" Width="400" Height="400" ID="chatTabs">
       <items>
       <ext:Panel runat="server" Title="Title1"></ext:Panel>
       <ext:Panel ID="Panel1" runat="server"  Title="Title1">
       <Items>
       <ext:Panel runat="server" TitleCollapse="true"  StyleSpec="position:absolute;bottom:5px;left:5px;">
       <Content>Hi</Content>
       </ext:Panel>
       </Items>
       </ext:Panel>
       </items>
       </ext:TabPanel>
        </form>
        
    </body>
    </html>
  2. #2

    RE: [CLOSED] Update TabPanel content without activating

    Hi,

    The TabPanel doesn't render tab until it's activating because many controls don't like rendering to the hidden area (hidden area has no size therefore controls can't determine correctly own size)


    Try to set DeferredRender="false" for TabPanel, it will force immediate rendering but can be issue related with incorrect size of the tab's child controls
  3. #3

    RE: [CLOSED] Update TabPanel content without activating

    Nopes still d same....
    Infact body is not rendered... if I run tab5.body.update("dummy"); even tht gices an error...

    Anything else tht I can try?

  4. #4

    RE: [CLOSED] Update TabPanel content without activating

    Hi,

    Call the following code after tab adding (don't forget DeferredRender="false")
    chatTabs.doLayout();
    Why is it such behaviour? I can suggest the following code (without DeferredRender="false" and 'doLayout')
    <Click Handler="var item = tab5.items.get(0); if(item.rendered){item.body.update('dummy');}else{item.html = 'dummy';}" />
  5. #5

    RE: [CLOSED] Update TabPanel content without activating

    It seems to be working

    Cant use what u suggested...

    I hv made a chat app... On double click of user the tab opens and the user can chat...

    Now if the user closes the tab... and the other user sends a message... I recreate the tab and update it with the new message.

    But I dont want them to lose focus if they r chatting with another user by having setActiveTab(). The tab can add in the background and mesages can be updates until its activated to see...

    Hope u can visualise what I mean...

    Thanks,


Similar Threads

  1. [CLOSED] First tab not activating
    By wisdomchuck in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 10, 2012, 8:00 PM
  2. Replies: 0
    Last Post: Oct 19, 2010, 7:39 AM
  3. [0.8] Update content with AjaxEvent.
    By mojo in forum 1.x Help
    Replies: 0
    Last Post: Oct 14, 2010, 3:01 PM
  4. [0.8.2] Update Content
    By thchuong in forum 1.x Help
    Replies: 2
    Last Post: Jun 18, 2010, 2:31 AM
  5. [CLOSED] Content Update problem
    By sz_146 in forum 1.x Help
    Replies: 2
    Last Post: Oct 29, 2008, 5:55 AM

Posting Permissions