1. #1
    Ext User ebaker280's Avatar
    Join Date
    May 2008
    Posts
    4
    Vote Rating
    0
    ebaker280 is on a distinguished road

      0  

    Default Render to new dynamic tab (using rails)

    Render to new dynamic tab (using rails)


    I'm using Ext with Ruby on Rails. I have a viewport with a border layout. In the west region is a site navigation tree, and in the center region is a tab panel. My navigation tree listener responds by creating a new tab in the tab panel and loading a url:

    Code:
    listeners: {
                      click: function(n) {
                          var t = tabPanel.findById(n.attributes.text);
                          if (!t) {
                              t = tabPanel.add(new Ext.Panel({
                                  id: tabId,
                                  title: "Tab titles goes here",
                                  closable: true
                              }));
                          }
                          tabPanel.setActiveTab(t);
                          var updater = t.getUpdater();
                          updater.update({
                              url: "/ror_controller/" + ror_action,
                              scripts: true
                          })
                      }
                  }
    The javascript in my RoR action template is eval'd, but how do I render an Ext component into my new tab? In other words, if I embed javascript code within my RoR view template that creates Ext components, how do I make those components render to the new tab? For example, how do I display a new panel, or a grid panel, within the newly created tab?

    Thanks!

  2. #2
    Ext User ebaker280's Avatar
    Join Date
    May 2008
    Posts
    4
    Vote Rating
    0
    ebaker280 is on a distinguished road

      0  

    Default Solved myself

    Solved myself


    I'm such a noob! All I needed was the id of my new panel, and then I can call add() with new components. Doh! I think Ext is finally starting to "click" for me.

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    If you insist on adding a new Component inside a Panel which is added to a TabPanel, then at least consider the layout of that completely redundant wrapping Panel.

Thread Participants: 1