Search code examples
javascriptextjsscrollextjs5treepanel

autoscroll is not working on Tree Panel


I try to add scrollbar to the tree panel but even if I add the autoscroll : true it doesn't scroll.

here is the panel :

Ext.create('Ext.tree.Panel', {
                                title: 'asdasd',
                                autoscroll:true,
                                store: store,
                                rootVisible: false,
                            });

And also, i show this panel on new window.


Solution

  • If you use ExtJS5 you should use scrollable config for that purpose. (http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext.Component-cfg-scrollable)

    Here is the fiddle I've made to try it: https://fiddle.sencha.com/#fiddle/jd4

    var store = Ext.create('Ext.data.TreeStore', {
    
    root: {
        expanded: true,
        children: [{
            text: "Grand Parent",
            checked: false,
            isSelected: false,
            id: '1',
            children: [{
                text: 'Child Node',
                checked: false,
                IsSelected: false,
                id: '1.1',
                children: [{
                    text: "Grand Child One",
                    expanded: true,
                    checked: false,
                    isSelected: false,
                    id: '1.1.1',
                }, {
    
                    text: "Grand Child Two",
                    expanded: true,
                    checked: false,
                    isSelected: false,
                    id: '1.1.2',
                }, {
    
                    text: "Grand Child Three",
                    expanded: true,
                    checked: false,
                    isSelected: false,
                    id: '1.1.3',
                }]
            }, {
    
                text: 'Child Two',
                checked: false,
                isSelected: false,
                id: '1.2',
                children: [{
                    text: "Grand Child Four",
                    expanded: true,
                    checked: false,
                    isSelected: false,
                    id: '1.2.1',
                }]
            }]
    
        }]
    }
    });
    
    Ext.create('Ext.tree.Panel', {
    title: 'Example Tree',
    width: 200,
    height: 450,
    store: store,
    rootVisible: false,
    multiSelect: true,
    scrollable: true,
    renderTo: Ext.getBody(),
    
    });