1. #1
    Ext User
    Join Date
    Oct 2010
    Posts
    15
    Vote Rating
    0
    sebbalex is on a distinguished road

      0  

    Default Layout problem with Grid

    Layout problem with Grid


    Hi all,
    I've a problem sizing a layout for grid, I set to all parent a FitLayout but it has a wrong size as shown in fig:

    if the grid size is full (50 elements) its layout goes over the south panel (without scroll)
    These are the property I've set:

    LayoutClass: (it extends LayoutContainer)
    Code:
    LayoutContainer center = new LayoutContainer(new FitLayout());
    center.setScrollMode(Scroll.AUTO);
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(0));
    centerData.setSplit(false);
    centerData.setCollapsible(true);
    centerData.setFloatable(true);
    Tabs tabs = new Tabs();
    center.add(tabs);
    add(center, centerData);
    Tabs:
    Code:
    tabPanel = new TabPanel();
            tabPanel.setLayoutData(new FitLayout());
            tabPanel.setAutoHeight(true);
            tabPanel.setResizeTabs(true);
            tabPanel.setAnimScroll(true);
            tabPanel.setTabScroll(true);
            tabPanel.setCloseContextMenu(true);
    setLayout(new FitLayout());
            add(tabPanel);
    
    public void addTabWithWidget(String text, LayoutContainer p) {
            if (!hashMap.containsKey(text)) {
                TabItem item = new TabItem();
                item.setLayout(new FitLayout());
    //        item.setText("New Tab " + ++index);
                item.setText(text);
                item.setClosable(index != 0);
                //item.addText("Tab Body " + index);
                item.add(p);
                item.addStyleName("pad-text");
                item.addListener(Events.Close, new Listener<BaseEvent>() {
    
                    public void handleEvent(BaseEvent be) {
                        hashMapRecalc();
                    }
                });
                tabPanel.add(item);
                tabPanel.setSelection(tabPanel.getItem(tabPanel.getItemCount() - 1));
                hashMap.put(text, tabPanel.getItemCount() - 1);
                index++;
            } else {
                tabPanel.setSelection(tabPanel.getItem(Integer.parseInt(hashMap.get(text).toString())));
            }
        }
    Grid (it extends LayoutContainer):
    Code:
    setLayout(new FlowLayout(10));
            grid.setLoadMask(true);
            grid.setBorders(true);
            grid.setAutoExpandColumn("nome");
            grid.setLayoutData(new FitLayout());
            grid.setAutoHeight(true);
    
            ContentPanel panel = new ContentPanel();
            panel.setFrame(true);
            panel.setCollapsible(true);
            panel.setAnimCollapse(false);
            // panel.setIcon(Resources.ICONS.table());
            panel.setHeading("PatchFinder List");
            panel.add(grid);
            panel.setLayoutData(new FitLayout());
            panel.setAutoHeight(true);
            
            //panel.setSize(800, 400);
            panel.setBottomComponent(toolBar);
            grid.getAriaSupport().setLabelledBy(panel.getId());
            add(panel);
    thanks @all

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Is the "panel" the only child of the layoutcontainer, which is a child of the tabitem?

    Also autoheight is not fully supported and cannot be supported by definition with a FitLayout.

  3. #3
    Ext User
    Join Date
    Oct 2010
    Posts
    15
    Vote Rating
    0
    sebbalex is on a distinguished road

      0  

    Default


    Yes panel is the only child.
    If I don't use autoheight the grid height is 0 and I cannot see any elements, if I set a manual size everything goes fine but I want avoid to use it because will be different with a different screen resolution.
    thanks

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    if I set a manual size everything goes fine but I want avoid to use it because will be different with a different screen resolution.
    Thats why GXT has a layoutsystem.

    Give the TabItem a FitLayout. Also gve your LayoutContainer a FitLayout and the ContentPanel a FitLayout. Than remove autoheight from the grid and the ContentPanel.

    Also why do you have an extra LayoutContainer in between there? Cannot you better add the ContentPanel directly to the TabItem?

  5. #5
    Ext User
    Join Date
    Oct 2010
    Posts
    15
    Vote Rating
    0
    sebbalex is on a distinguished road

      0  

    Default


    What is the extra LayoutContainer??
    and I use the ContentPanel in the grid just to set the content and the bottom toolbar (to paginate)
    just like:
    http://www.sencha.com/examples/explorer.html#paging
    am I wrong?

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Grid (it extends LayoutContainer):
    That sounds like oyu use an extra LayoutCOntainer where you put in the panel that holds the grid.
    and I use the ContentPanel in the grid just to set the content and the bottom toolbar (to paginate)
    I am not saying you should remove that.

  7. #7
    Ext User
    Join Date
    Oct 2010
    Posts
    15
    Vote Rating
    0
    sebbalex is on a distinguished road

      0  

    Default


    I've added a ContentPanel and cut off the both SetAutoHeight result is:

    Tabs:
    Code:
        public void addTabWithWidget(String text, LayoutContainer p) {
            if (!hashMap.containsKey(text)) {
                TabItem item = new TabItem();
                ContentPanel cp = new ContentPanel();
                cp.setHeading(text);
                cp.add(p);
                cp.setLayout(new FitLayout());
                item.setLayout(new FitLayout());
                item.setText(text);
                item.setClosable(index != 0);
                item.add(cp);
                item.addStyleName("pad-text");
                item.addListener(Events.Close, new Listener<BaseEvent>() {
    
                    public void handleEvent(BaseEvent be) {
                        hashMapRecalc();
                    }
                });
                tabPanel.add(item);
                tabPanel.setSelection(tabPanel.getItem(tabPanel.getItemCount() - 1));
                hashMap.put(text, tabPanel.getItemCount() - 1);
                index++;
            } else {
                tabPanel.setSelection(tabPanel.getItem(Integer.parseInt(hashMap.get(text).toString())));
            }
        }
    Grid:
    Code:
            grid.setLoadMask(true);
            grid.setBorders(true);
            grid.setAutoExpandColumn("nome");
            grid.setLayoutData(new FitLayout());
            //grid.setAutoHeight(true);
    
            ContentPanel panel = new ContentPanel();
            panel.setFrame(true);
            panel.setCollapsible(true);
            panel.setAnimCollapse(false);
            // panel.setIcon(Resources.ICONS.table());
            panel.setHeading("PatchFinder List");
            panel.add(grid);
            panel.setLayoutData(new FitLayout());
            //panel.setAutoHeight(true);
            
            //panel.setSize(800, 400);
            panel.setBottomComponent(toolBar);
            grid.getAriaSupport().setLabelledBy(panel.getId());
            add(panel);

  8. #8
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Do you have a FitLayout on the LayoutContainer that holds the ContentPanel with the grid?

  9. #9
    Ext User
    Join Date
    Oct 2010
    Posts
    15
    Vote Rating
    0
    sebbalex is on a distinguished road

      0  

    Default


    I've a FlowLayout at the start of Grid class:

    Code:
    setLayout(new FlowLayout(10));
    and I add the CP in this LayoutContainer (I've also tried before to put a FitLayout without results)

  10. #10
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    A flowlayout is not sizing anything. You need to use a FitLayout there, else your layoutchain is broken.

    Also your "panel" has no layout set.

Similar Threads

  1. Layout/Grid problem
    By marcinKozlowicz in forum Ext GWT: Help & Discussion (1.x)
    Replies: 57
    Last Post: 15 Dec 2009, 11:19 AM
  2. Grid Layout Problem in Firefox
    By kckc1234 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 15 Dec 2009, 8:17 AM
  3. problem with grid in column layout
    By zoli in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 24 Aug 2008, 2:06 AM
  4. page layout/grid problem
    By mike1993 in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 30 Apr 2008, 1:49 PM
  5. Grid Resizing/Layout problem
    By Novael in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 22 Jan 2008, 4:37 PM

Thread Participants: 1

Tags for this Thread