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

  • Home
  • SEARCH
  • 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 8206881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:49:32+00:00 2026-06-07T08:49:32+00:00

ExtJS4 I’m trying to move a treenode to gridpanel. I want its associated data

  • 0

ExtJS4

I’m trying to move a treenode to gridpanel. I want its associated data to be inserted here. But whenever I move the treenode, it creates an empty row at that position.
I’ve created the tree as:

    var treeData = {
        text: 'Business Processes',
        children:[
            {text: 'Process7', lob: 'Lob7', leaf:true},
            {text: 'Process8', lob: 'Lob8', leaf:true},
            {text: 'Process9', lob: 'Lob9', leaf:true},
            {text: 'Process10', lob: 'Lob10', leaf:true},
            {text: 'Process11', lob: 'Lob11', leaf:true},
            {text: 'Process12', lob: 'Lob12', leaf:true}
        ]
    };
    bpTreeStore = Ext.create('Ext.data.TreeStore',{});
    bpTreeStore.setRootNode(treeData);

    new Ext.TreePanel({
        id:'businessProcessTree',
        store : bpTreeStore,
        viewConfig: {
            plugins:{
                ptype: 'treeviewdragdrop',
                dropGroup: 'dragGroup',
                dragGroup: 'dragGroup',
                dragText: 'Place the node to grid'
              }
        }
    });

And the grid as

Ext.define('BusinessProcessStoreModel',{
extend:'Ext.data.Model',
fields: [
{ name:'businessProcessName', type:'string' },
{ name:'businessProcessLob', type:'string' }
]
});
bpMappingStore = Ext.create('Ext.data.ArrayStore', {
        model:'BusinessProcessStoreModel',
        data:[
            ['Process1', 'Lob1'],
            ['Process2', 'Lob2'],
            ['Process3', 'Lob3']
        ]
    });
var bpMappingGrid = Ext.create('Ext.grid.Panel',{
        id:'bpGridPanel',
        region:'center',
        frame:true,
        layout:'fit',
        height:300,
        columns:[
        { header:'Process Name', dataIndex:'businessProcessName' },
        { header:'Process Lob', dataIndex:'businessProcessLob' }
        ],
        store:bpMappingStore,
        viewConfig: {
            plugins:{
                ptype: 'gridviewdragdrop',
                dropGroup: 'dragGroup',
                dragGroup: 'dragGroup',
                dragText: 'Place the node to grid'
              },
            listeners: {
                drop: function(node, data, overModel, dropPosition)
                {
                    var position = (dropPosition=='after'?overModel.index + 1: overModel.index -1);
                    Ext.getCmp('bpGridPanel').store.insert(position, [[data.records[0].data.text, 'LOB']]);
 //data.records[0].data.lob is undefined don't know why

                }
            }
        }
    });

Please tell me how I refer to the ‘text’ and ‘lob’ of the treenode to be inserted into the two columns of the gridpanel.

Here I’ve created my own

  • 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-07T08:49:35+00:00Added an answer on June 7, 2026 at 8:49 am

    I solved the problem. Make sure that the Treenode being dragged must contain the attributes in the model which the grid is using.

    Here, treedata can be defined as

    var treeData = {
            text: 'Business Processes',
            children:[
                {text: 'Process7', businessProcessName: 'Process7', businessProcessLob: 'Lob7', leaf:true},
                {text: 'Process8', businessProcessName: 'Process8', businessProcessLob: 'Lob8', leaf:true},
                {text: 'Process9', businessProcessName: 'Process9', businessProcessLob: 'Lob9', leaf:true},
                {text: 'Process10',businessProcessName: 'Process10', businessProcessLob: 'Lob10', leaf:true},
                {text: 'Process11', businessProcessName: 'Process11', businessProcessLob: 'Lob11', leaf:true},
                {text: 'Process12', businessProcessName: 'Process12', businessProcessLob: 'Lob12', leaf:true}
            ]
        };
        this.bpTreeStore = Ext.create('Ext.data.TreeStore',{root: this.treeData});
    

    But when we assign this treedata object to the treestore. It removes the new attributes (businessProcessName and businessProcessLob).

    So to add them, a loop can be run.

    for(var index in treeData.children)
    {
        this.bpTreeStore.tree.root.childNodes[index].data.businessProcessName = treeData.children[index].businessProcessName;
        this.bpTreeStore.tree.root.childNodes[index].data.businessProcessLob = treeData.children[index].businessProcessLob;
    }
    

    After this, dragging works fine 🙂

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

Sidebar

Related Questions

I'm trying to load 'nested' data in a hasMany relation in ExtJS4. My model
I'm using extjs4 and What i'm trying to do seems to be simple but
I have a DatePicker in ExtJS4. I only want to allow TWO dates for
i'm new with extjs4, i have a problem with gridpanel that should be show
I'm working with ExtJS4 and trying to build a search feature using a form.
I'm using ExtJs4 and I'm trying to extend the Ext.form.field.ComboBox like below: Ext.define('GenericCombo', {
I use ExtJS4 to request data in format id-label ('id'-'rdfs:label' in my case). I
I have some problems with Extjs4 librairie. I want to use treeEditor component. Firebug
I want to create TreePanel using ExtJS4. So I'm sending JSON to proxy reader
What is the equivalent to the ExtJs3 Ext.grid.ColumnModel in ExtJs4? What I want to

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.