Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Horizontal scrollbar for treegrid cannot show up when having the Zindex set

    Hi, I am now configuring the horizontal scrollbar in a treegrid by setting the TreeGrid to autofitdata with 'overflow' set to auto. I have also included an 'expand all' link.

    I met two problems during the process.

    1. I found the horizontal scrollbar doesn't show up if i set the ZIndex in the layout. But I do need to set the Zindex or my page menu would be overlapped by the tree.

    Code:
    public void onModuleLoad() {
    		final TreeGrid listGrid = createListGrid(PortfolioHierarchyDataSource.getInstance());
    
    		HLayout layout = new HLayout();
    		layout.setWidth100();
    		layout.setHeight100();
    		layout.setMembers(listGrid);
    		//layout.setZIndex(0); ===== if this line is commented out, the horizontal scroll bar works fine, else the scroll bar doesn't show as expected.
    		layout.setOverflow(Overflow.AUTO);
    
    		RootPanel.get("portfolioHierarchyDivId").add(layout);
    
    	}
    
    private TreeGrid createListGrid(DataSource portfolioHierarchyDs) {
    		listGrid = new TreeGrid() {
    		};
    		
    		listGrid.setDataSource(portfolioHierarchyDs);
    
    		ListGridField nameField = new ListGridField("name", "Name");
    		nameField.setType(ListGridFieldType.LINK);
    		
                    listGrid.setFields(nameField);
    
    		listGrid.setLoadDataOnDemand(false);
    		listGrid.setAutoFetchData(true);
    		listGrid.setHeight100();
    		listGrid.setWidth100();
    		
    		listGrid.setZIndex(1);
    		listGrid.setAlternateRecordStyles(true);
    		listGrid.setResizeFieldsInRealTime(Boolean.TRUE);
    		
    		listGrid.setAutoFitData(Autofit.BOTH);			
    		listGrid.sort("name", listGrid.getSortDirection());
    		
                    return listGrid;
    	}
    2. Although a horizontal scrollar bar shows up, the first time I hit 'expand all' on the page, it doesn't move enough to see the whole tree. only after the second time when I hit 'expand all', the whole tree could be displayed.


    Would you please take a look when you have a chance? It's really an urgent case in our project.


    Thanks a lot in advance

    #2
    Don't set overflow on the TreeGrid. Use a containing element (a VLayout would do) with overflow:auto instead.

    Comment

    Working...
    X