Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8475555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:55:31+00:00 2026-06-10T17:55:31+00:00

Am trying to have a tree when a button is clicked. Basically this view

  • 0

Am trying to have a tree when a button is clicked. Basically this view has a toolbar in the top, and i want the tree to be displayed below the toolbar. Firstly, am confused what xtype should i use, whether its

xtype : 'treepanel'

or its

xtype : 'treeview'.

Here is the code for my tree

Ext.define('Campus.view.Hierarchy', {
    alias: 'widget.hierarchy',
    extend: 'Ext.panel.Panel',

    initComponent: function () {
        var config = {
            xtype: 'panel',
            border: false,
            autoScroll: true,
            baseCls: 'topMenu',

            dockedItems: [{
                xtype: 'toolbar',
                border: false,
                dock: 'top',
                items: [{
                    xtype: 'button',
                    text: LANG.BTADDREG,
                    iconCls: 'icon-add-tb',
                    cls: 'tip-btn',
                    iconAlign: 'right',
                    action: 'addRegion',
                    id: 'ADDREGION'
                }],
                items: [{
                    xtype: 'treepanel',
                    title: '',
                    border: false,
                    enableDD: true,
                    viewConfig: {
                        enableDD: true,
                        plugins: {
                            ptype: 'treeviewdragdrop'
                        }
                    },
                    collapsible: false,
                    useArrows: true,
                    rootVisible: false,
                    store: 'HierarchyTree',



                    multiSelect: false,
                    singleExpand: false,
                    id: 'TREE'

                }]
                var holder = Ext.getCmp('center');
                holder.remove(0);
                holder.add(Ext.apply(config));
            }    

Am defining the store inside the tree because,defining the tree store in the app/store folder, shows error as follows:

me.store.getRootNode is not a function
node: me.store.getRootNode()

/Model

Ext.define('App.model.HierarchyTree', {
extend : 'Ext.data.Model',
fields : ['Title', 'ID', 'LevelID', 'ParentID']
});

/Store

Ext.define('App.store.HierarchyTree', {
extend : 'Ext.data.Store',
model : 'Campus.model.HierarchyTree',
storeID : 'HierarchyTree',

proxy : {
    type : 'ajax',
    url : 'data/Locations.aspx',
    reader : {
        type : 'json',
        root : 'Rows'
    },
    actionMethods : {
        create : 'POST',
        read : 'POST'
    },
    extraParams : {
        mode : 'HIERARCHYFULLLIST'

    }
},
autoLoad : true

});

Also, when i use xtype :'treepanel', its just showing a horizontal scrollbar, and nothing else.
And when i use xtype: 'treeview', its showing

me.panel is undefined
treeStore = me.panel.getStore();

Could anyone please tell me what mistake am i doing

EDIT

The config is applied to Ext.getCmp(‘center’) because the application is divided into three sections, and so whenever we display a view, we get hold of the center region of the application, and then display it

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:55:33+00:00Added an answer on June 10, 2026 at 5:55 pm

    Your code has some errors. you have two ‘items’ in the panel config, the first one should be ‘tbar’.

    Another error is how you add the store, you should just add the class store : 'HierarchyTree' or to create the store store: Ext.create('App.store.HierarchyTree',{}).

    And you should use treepanel since treeview is just the view used by the treepanel.
    Add this fixes and see if it will work or if not post the new issues. Hope it helps.

    EDIT

    Ok so another thing, initComponent function must contain the call to the parent function.

    this.callParent(); // at the end of the initComponent function.
    

    And I still have some questions why do you apply the config to an item you get with ext.getCmp, isn’t the config for the ‘Campus.view.Hierarchy’ object ?
    If so you should apply directly to ‘this’ object.

    Ext.apply(this,config);
    this.callParent(); 
    

    As it is now, it is not applying the config since apply takes two arguments the destination object and the config object.

    EDIT
    On the issue with the config, you cannot apply the config to the center panel like that, because it’s not rendered.
    So rather than doing that you should add the config to the current panel, and add the curent panel to the viewport, which i guess it has layout border.
    This shoud be the init component function:

    config = {
    ...}
    Ext.apply(this,config);
    this.callParent(); 
    

    And the panel which contains the center region should have the panel as an item.

     ...some viewport...
       layout:'border',
       items: [
            { 
               xtype:'hierarchy',
               region: 'center'
            }
       ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to have a tree display custom data that looks like this.
I am trying to Drag a toolbar button to a tree node. Is it
I have this tree I'm trying to work with.. I have it currently as
I am trying to have a javascript object tree behave like a php associative
I have a python script that is trying to create a directory tree dynamically
I'm trying to implement tree algorithms in C. I have declared a extern struct
I'm trying to create an expression tree dynamicly. Let asume that I have two
I'm developing an iPhone application and I'm trying to do this: I want an
I have this dom tree: <li class=badge_listtwo> <div class=badge_spacetwo> <p class=badge_title>$badge_title</p> <div class=badge_button> <img
I have a tree in WPF that has no root node, but has defined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.