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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:36:44+00:00 2026-06-06T03:36:44+00:00

Am working on moving nodes in a tree, and as they are moved, their

  • 0

Am working on moving nodes in a tree, and as they are moved, their ID’s are updated in the database through C# in the back-end. Till now, i have managed to update the position of the node that is being moved, but after its moved, the position of the other nodes in the tree should also get updated. Could anyone tell me how to proceed with this?

itemmove : {
fn : function(v, oldParent, newParent, index, eOpts) {
var nodeID = v.data.id;
var oldParent = oldParent.data.id;
var newParent = newParent.data.id;
var index = index;
var level = v.data.level;
movenode(nodeID, oldParent, newParent, index, level);
}
}


function movenode(nodeID, oldParent, newParent, index, level) {
Ext.Ajax.request({
    url : 'data/pages.aspx',
    params : {
        UserID : USER.UserID,
        mode : 'MOVENODE',
        currentNode : nodeID,
        oldParentNode : oldParent,
        newParentNode : newParent,
        index : index,
        level : level,
        ProjDB : projDB
    },
    success : function() {
        loadTREEst();
        genMessage(LANG.Suc, LANG.SaveOK, 'tick', false);

    },
    failure : function() {
        genMessage(LANG.Warn, LANG.GenWarn, 'warn', false);
    }
});
}

So, i send the parameters to SQl, and then update the index of the node that has been moved.

For example, if i move a node from position 8 to 1, the index of the 8th node changes to 1 in the database, but the index of the first node remains at 1. And because of this, the tree also doesnt get updated. i want all the other nodes in the tree to get updated as well. So, in this case, the node in index 1 will become index 2, the node in index 2 will become index 3, and so on. Can anyone explain me how to do this.

Is there any other method other than autosync or sync to do this?
Thanks in advance.

  • 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-06T03:36:46+00:00Added an answer on June 6, 2026 at 3:36 am

    Here is some sample code that works with 4.1:

    Ext.define('BS.model.ItemCategory', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'name'     , type: 'string'},
            {name: 'iconCls'  , type: 'string', defaultValue: 'treenode-no-icon'},
            {name: 'leaf'     , type: 'boolean', defaultValue: false},
            {name: 'expanded' , type: 'boolean', defaultValue: true, persist: false},
            {name: 'index'     , type: 'int'},        
        ],
    
        proxy: {
            type: 'direct',
    
            api: {
                create: ItemCategories.Create,
                read: ItemCategories.Read,
                update: ItemCategories.Update,
                destroy: ItemCategories.Delete,
            },
        }, 
    });
    

    You won’t be having a direct proxy as your server isn’t php, but just put the corresponding server scripts (see docs).

    Then my store:

    Ext.define('BS.store.ItemCategories', {
    
        extend: 'Ext.data.TreeStore',    
        model: 'BS.model.ItemCategory',
    
        autoSync: true,
    
        root: {
            text: 'Root',
            id: 'NULL',
            expanded: true
        },
    
        clearOnLoad: true,
    });
    

    And the view:

    Ext.define('BS.view.admin.pages.item-categories.ItemCategories' ,
    {
        extend: 'Ext.tree.Panel',
        alias : 'widget.item-categories-tree',
    
        store: 'ItemCategories',
    
        displayField: 'name',
    
        rootVisible: false,
        useArrows: true,
        multiSelect: false,
        singleExpand: false,    
        allowDeselect: true,
    
        plugins: {
            ptype: 'treeviewdragdrop',                    
        },          
    });
    

    That’s pretty much it! When you move a node you’ll see ExtJS sends an update request to the server with an array of all the nodes whose index (sort) has changed.

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

Sidebar

Related Questions

I'm currently working on a project that involves moving a database of documents for
I am working on moving a database from MS Access to sql server. To
I'm working on moving some Photoshop comps into code and have reached a point
I am working on doing some data transfers moving data from one database to
Now I'm working on a project which require me to get mouse moving message
i have been working on moving one of my apps away from the shared
At the place I am working we are moving to a more agile approach
I am working with teamcity and and moving some old integration tests over to
I'm working with about 20 objects that are moving around in 3D space. Adobe
I am working on a charity site and was tasked with moving a WordPress

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.