Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Grid ColumnHeader Menu missing

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTGWT-3741 in 3.1.2.
  1. #11
    Sencha Sr Product Manager
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    1,177

    Default

    From the looks of it, the Grid is not getting a size by the parent container or the child container. In the first post, I don't see a size given to the grid before its added to the RootPanel. The grid requires a size by either its parent or set directly to the widget.

    Is a size bing given from the parent or or being provided directly to it? If its in a tab, set the HideMode.Offsets on the upper most parent that is added to to the tab. If something is failing to layout properly when switching to a tab, a workaround may be to call parentContainer.forceLayout() so the sizing is sent to all the children. Just a note, if any containers have layout data with -1, it will shut off sizing being sent to those children for that -1 width or height.

    Just out of curiosity, does the layout get fixed if you change the window size?

  2. #12
    Sencha User
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    223

    Default

    Quote Originally Posted by branflake2267 View Post
    From the looks of it, the Grid is not getting a size by the parent container or the child container. In the first post, I don't see a size given to the grid before its added to the RootPanel. The grid requires a size by either its parent or set directly to the widget.
    Setting sizes doesn't change anything. I did this:
    Code:
    import java.util.ArrayList;
    import java.util.List;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.sencha.gxt.data.shared.ListStore;
    import com.sencha.gxt.widget.core.client.TabPanel;
    import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
    import com.sencha.gxt.widget.core.client.grid.ColumnModel;
    import com.sencha.gxt.widget.core.client.grid.Grid;
    
    public class Demo implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            ListStore<String> store = new ListStore<String>(null);
            List<ColumnConfig<String, ?>> configs = new ArrayList<ColumnConfig<String, ?>>();
            configs.add(new ColumnConfig<String, String>(null, 100, "col 1"));
            configs.add(new ColumnConfig<String, String>(null, 100, "col 2"));
            ColumnModel<String> cm = new ColumnModel<String>(configs);
            Grid<String> grid = new Grid<String>(store, cm);
            grid.setSize("555px", "222px"); // Gets ignored anyway, since grid will use all space within tab.
    
            TabPanel tabP = new TabPanel();
            tabP.setSize("666px", "333px");
            tabP.add(new Label("foo"), "lbl foo");
            tabP.add(grid, "grid");
    
            RootPanel.get().add(tabP);
        }
    }

  3. #13
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737

    Default

    Instead of using setSize(String, String), which only sets css sizes (and so cannot be used for layouts, which require actual pixel sizes to measure how much space each child can use), use setPixelSize(int, int), or setHeight(int) and setWidth(int). If you do this to the TabPanel, it will size its child to fit (the grid will be sized *implicitly*), or give the grid a size directly and dont worry about the tabpanel sizing (the grid in this case is sized *expliciticly*).

  4. #14
    Sencha User
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    223

    Default

    Quote Originally Posted by Colin Alworth View Post
    Instead of using setSize(String, String), which only sets css sizes (and so cannot be used for layouts, which require actual pixel sizes to measure how much space each child can use), use setPixelSize(int, int), or setHeight(int) and setWidth(int). If you do this to the TabPanel, it will size its child to fit (the grid will be sized *implicitly*), or give the grid a size directly and dont worry about the tabpanel sizing (the grid in this case is sized *expliciticly*).
    Afaics, setSize(String, String) calls setPixelSize(int, int) if width and height end with "px" or are just numbers ("px" is added then at first; later Strings get parsed to int).
    On CSS/Element base the size is set if there is given another unit like "em", "cm" or "in".

    Do I really have to explain your code to you?

    For simplicity, of course, I should have used setPixelSize(int, int).

Page 2 of 2 FirstFirst 12

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
  •