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 8544717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:37:41+00:00 2026-06-11T12:37:41+00:00

I wanted to add a custom object as treenode in a tree panel. It

  • 0

I wanted to add a custom object as treenode in a tree panel.
It will be used as

var complex_object = {....}
myTree.getRootNode().appendChild(new MyNode(complex_object));

To implement such feature I found Ext.data.NodeInterface whcih provides a common interface to tree nodes. So I tried to extend it. Here is how its done.

var MYNS = {
       TreeNode: new Ext.Class({
        protocol : "",
        displayName : "",
        extend: 'Ext.data.NodeInterface',
        constructor : function(line) {
            this.protocol = get_protocol(line);
            this.displayName = get_display_name(line);
            var configObj = {
                id : this.protocol + "-" + this.displayName,
                text : this.displayName,
                leaf : true,
                iconCls : protocol+"-user"
            };
            this.callParent([configObj]);
        }
    })
}

As it turns out this does not create any extended class of Ext.data.NodeInterface. It however creates object bud has not function from its parent.

 var a = new MYNS.TreeNode(...);
 a.appendChild(); // throws error

Am I do it wrong? How do Correctly do 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-11T12:37:42+00:00Added an answer on June 11, 2026 at 12:37 pm

    Ext.data.NodeInterface is a ‘factory’ for decorating the prototype of Ext.data.Model classes with properties/functions required.

    This class is used as a set of methods that are applied to the prototype of a Model to decorate it with a Node API. This means that models used in conjunction with a tree will have all of the tree related methods available on the model.

    This is how you would use it:

    Ext.define('app.MyModel', {
        extend: 'Ext.data.Model',
    
        fields: [ /*...*/ ],
    
        /*...*/
    });
    
    Ext.data.NodeInterface.decorate('app.MyModel'); // String will be resolved to Class object internally
    
    var obj = Ext.ModelManager.create(parent, 'app.MyModel');
    obj.appendChild(/*...*/);
    

    The central method is Ext.data.NodeInterface#decorate – see the docs – which facilitates #getPrototypeBody internally. These are both static methods. You could override getPrototypeBody to manipulate the class definition.
    For other Ext classes to pick up the changes you would rather have to override Ext.data.NodeInterface instead of extending it.

    However, another approach is to add the required functionality by extending Ext.data.Model – this might actually be the more straight-forward approach to your requirement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a custom add-in ribbon for MS Word 2010. I wanted to
I wanted to add a new property to one of my model (table). Basically
I wanted to add <br> after every 2 loops. The loop will run 8
Basically, I wanted to add a few custom methods to google.maps.Map and Rectangle classes.
When i add a new from my custom CMS, i need to add some
I am playing around with the ARKit API ...I wanted to add Custom UIButton
I wanted to add crash reporting capabilities to my iPhone app. Kind of the
I wanted to add a StackOverflow-style tag input to a blog model of mine.
I wanted to add some analytics functionnalities to my app so I created an
I wanted to add 2 columnts to an MSSQL table by changing class and

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.