Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Dynamically changing the content of a tab

  1. #1

    Default Dynamically changing the content of a tab

    Hi All,
    I have a series of tabs in a tab panel and I need to change the content of one of them based on a selection elsewhere. The content is either a gridPanel or a series of fields and also a gridpanel. The tab is set to layout: "border".

    Ideally what I want to do is hide or remove the gridPanel and replace it with a different panel, or possibly back again.
    I initially tried having 2 different tabs which would work but would need to be able to hide one of them at any time.

    Any suggestions for a potential solution would be great.

    Thanks

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Two solutions:
    1. Use a card layout on the tab item.
    2. Use two tab items and use show/hideTabStripItem to show/hide the tab.

  3. #3

    Default

    Thanks Condor,
    Will the card layout add scrollbars for the grid and expand to fill the space automatically like it would in a border layout? I've never had to use that before. I know...RTFM

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    I meant:
    Code:
    tabpanel
    - tab1
    - container with layout:'card'
      - container with layout:'border'
        - form with region:'north'
        - grid with region:'center'
      - grid
    - tab3
    (card layout descends from fit layout - tabpanel also uses it)

  5. #5

    Default

    thanks. trying it out now.

  6. #6

    Default

    Ok, that didn't work. Nothing is showing as per the image.
    findings.jpg
    The tab item is set up with the following code. The grid item itself works fine and the form is basically a test panel with a label in it with hello world, a placeholder really The form itself is set to hidden so should not show - am I missing something?
    TIA
    Snippetnew Ext.Panel({
    id: "pnlCardFindings",
    title: "Findings",
    layout: "card",
    items: [
    new Ext.Panel({
    id: "pnlBorderFindings",
    layout: "border",
    items: [
    this.findingsTabGrid,
    this.findingsTabForm
    ]
    })
    ]
    }),

  7. #7
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You need to select one of the cards, e.g.
    Code:
    layoutConfig: {activeItem: 0}

  8. #8

    Default

    Tried the activeItem but then if everything is inside a panel it would surely only have one item, tried 2 panels and then tried just the items directly since the form will be in a panel as it will also have a grid in it.

    Nothing. same as before.

    So, next question, is there a way to initialise the tab as being hidden initially or will it have to be done programatically. changing them using show/hideTabStripItem will work but would like the form hidden on load.

    Thanks.

  9. #9
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    1. I thought you needed a tab that could switch between two views (grid-a and form+grid-b)?

    2. No, you would need to hide it in the render event of the tabpanel.

  10. #10

    Default

    Either would work. I need a tab that could contain 2 views but would equally happily have 2 different tabs, each containing different views that could be hidden/shown as needed.

    Right now I just want a solution that will work and if it has 2 tabs pretending to be the same tab and just show/hide them then that works for me.

Page 1 of 2 12 LastLast

Similar Threads

  1. Changing tab content without redrawing page?
    By RodS1967 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 19 Apr 2010, 7:47 AM
  2. changing TabPanel's tab titles dynamically
    By usmanf in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 21 Dec 2009, 2:56 AM
  3. Dynamically changing portal content (border layout)
    By kovomaster in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 7 Aug 2009, 3:21 AM
  4. dynamically changing content of a tooltip
    By chrizmaster in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 24 Jul 2009, 5:37 AM
  5. Dynamically changing plain panel-content to NestedLayout
    By dante in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 23 Aug 2007, 2:35 AM

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
  •