1. #1
    Sencha User
    Join Date
    May 2008
    Location
    Germany
    Posts
    59
    Vote Rating
    0
    LukasP is on a distinguished road

      0  

    Default TreePanel scroll bar issues with long item texts

    TreePanel scroll bar issues with long item texts


    Hi!

    I hope you guys can help me to figure out why this code is not working properly.
    I am trying to render a TreePanel with some items which have long texts on it, so I would expect some scrollbars to appear if necessary, but they don't.

    I am using FF 3.5.30729, GXT 2.1.1 and GWT 2.0.2.

    Code:
    public class MainEntryPoint implements EntryPoint {
    
        public void onModuleLoad() {
    
            ContentPanel panel = new ContentPanel();
            panel.setHeading("Content Panel");
            panel.setSize(200, 200);
            panel.setScrollMode(Scroll.AUTO);
    
            TreePanel tree = new TreePanel(new TreeStore());
            tree.setDisplayProperty("text");
            tree.setAutoHeight(true);
            tree.setAutoWidth(true);
    
            BaseTreeModel mLong = new BaseTreeModel();
            mLong.set("text", "This is a very long item text which causes some issues with the scrollbars on ContentPanel/ TreePanel");
            tree.getStore().add(mLong, false);
    
            for (int i = 0; i < 30; i++) {
                BaseTreeModel m = new BaseTreeModel();
                m.set("text", "SomeText");
                tree.getStore().add(m, false);
            }
    
            panel.add(tree);
    
            RootPanel.get().add(panel);
    
        }
    }
    The first model item's text is long so one should expect that a horizontal scrollbar should appear immediately. This does not happen for me.
    If I then use the vertical scrollbar to scroll down to the end of the tree, I can find the scrollbar, but if I use it another one appears, resulting in a weird behaviour.

    Does anyone have the same trouble?

    I can not find any scrollbar-methods on TreePanel to change that behaviour, too...

    Also see these screenshots:


  2. #2
    Sencha User
    Join Date
    May 2008
    Location
    Germany
    Posts
    59
    Vote Rating
    0
    LukasP is on a distinguished road

      0  

    Default


    Ok, I just found out that the code works fine with IE. So it might be a Firefox-specific problem?

  3. #3
    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


    Remove
    Code:
     panel.setScrollMode(Scroll.AUTO);
    tree.setAutoHeight(true);
            tree.setAutoWidth(true);
    and add

    Code:
    panel.setLayout(new FitLayout());
    To your code. That should do it but i have not tested it.

  4. #4
    Sencha User
    Join Date
    May 2008
    Location
    Germany
    Posts
    59
    Vote Rating
    0
    LukasP is on a distinguished road

      0  

    Default


    Thanks sven, works like a charm!

    Just one small thing: The horizontal scrollbar disappears as soon as the "long item" is not displayed anymore, so the scrollbar keeps appearing and disappearing when scrolling up and down the tree. I would normally expect to have it staying if at least one item on the tree is too long. Is this is a feature or a bug?

    In my case FitLayout is fine for now, but how can I use other Layouts? Or do I always have to wrap TreePanel in some LayoutContainer with FitLayout?

    Thanks so much for your quick reply!

Thread Participants: 1