1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    6
    Vote Rating
    0
    Canto is on a distinguished road

      0  

    Post [FIXED] TabPanel + Drag&Drop

    [FIXED] TabPanel + Drag&Drop


    When closing tab that have d&d ContentPanel this ContentPanel doesn't die and it's still visible in previous tab (or in blank space if no tab are left). Panel isn't active, you cannot drag, collapse it but you can select text.


    Code:
    public class Platnosci extends Container implements EntryPoint {
    
        RootPanel rootPanel = RootPanel.get();
    
        public void onModuleLoad() {
            rootPanel.add(this);
        }
    
        public void onRender(Element parent, int pos) {
            super.onRender(parent, pos);
    
            TabPanel tabPanel = new TabPanel();
            tabPanel.enableTabScroll = true;
            tabPanel.setWidth(600);
    
            for (int i = 0; i < 5; i++) {
                TabItem tab = new TabItem();
                Date date = new Date();
                tab.setText(date.toLocaleString().replaceFirst(
                        "\\d\\d:\\d\\d:\\d\\d", ""));
                tab.closable = true;
                tab.setHeight("100%");
                HorizontalPanel hp = new HorizontalPanel();
                ContentPanel cp = new ContentPanel();
                cp.setHeading("lorem ipsum blah balh blah");
                cp.collapsed = true;
                cp.collapsible = true;
                cp.draggable = true;
                Draggable d = new Draggable(cp);
                d.container = MainPanel.tabPanel;
                hp.add(cp);
                tab.add(hp);
                tabPanel.add(tab);
            }
            rootPanel.add(tabPanel);
        }
    }
    You can ommit HorizontalPanel the effect is still the same.
    Problem seems to exists only when closing active(selected) tab.
    Last edited by darrellmeyer; 29 Apr 2008 at 7:44 PM. Reason: I've modified the source code to be one class and more readable.

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    Thanks for the code sample, it really helps. There was a bug when closing tabs which was noticable when closing the last tab. The fix is in SVN. Here is what the code looks like with the current code:
    Code:
      for (int i = 0; i < 2; i++) {
          TabItem tab = new TabItem();
          tab.setText("test");
          tab.setClosable(true);
          tab.setHeight("100%");
          HorizontalPanel hp = new HorizontalPanel();
          ContentPanel cp = new ContentPanel();
          cp.setHeading("lorem ipsum blah balh blah");
          cp.setCollapsible(true);
          cp.collapse();
    
          Draggable d = new Draggable(cp);
          d.container = tabPanel;
          hp.add(cp);
          tab.add(hp);
          tabPanel.add(tab);
        }

Thread Participants: 1