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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:22:33+00:00 2026-06-01T20:22:33+00:00

I have two instances of dynatree objects on a page. I have the trees

  • 0

I have two instances of dynatree objects on a page. I have the trees populate from various XML data. There is an onChange event which has the trees change the data they are using. The last thing I do during the change is sort the data. When I call the sort function it runs for both of the instances causing the first one to be sorted incorrectly. My code for the two sorts is:

$("#rightList").dynatree("getRoot").sortChildren(compareNodesRight, true);

Which uses this function as the comparision.

var compareNodesLeft = function(a,b)
{
   //Find the sequence tags for both a and b.
   var aKey = a.data.key;
   var bKey = b.data.key;
   var aValue = $(GLOBAL_LEFT_XML).find("item[id ='" + aKey + "'] data sequence").text();
   var bValue = $(GLOBAL_LEFT_XML).find("item[id ='" + bKey + "'] data sequence").text();
   return aValue > bValue ? 1 : aValue < bValue ? -1 : 0;
} 

The other function calls the other sort which is

$("#rightList").dynatree("getRoot").sortChildren(compareNodesRight, true);

It uses a function that is almost identical to the other except it is called

var compareNodesRight = function (a, b)
{
console.log("Comparing RIGHT");
//Find the sequence tags for both a and b.
var aKey = a.data.key;
var bKey = b.data.key;
var aValue = $(GLOBAL_RIGHT_XML).find("item[id ='" + aKey + "'] data sequence").text();
var bValue = $(GLOBAL_RIGHT_XML).find("item[id ='" + bKey + "'] data sequence").text();
return aValue > bValue ? 1 : aValue < bValue ? -1 : 0;
};

Any insight about the .sortChildren function would be great.

  • 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-01T20:22:34+00:00Added an answer on June 1, 2026 at 8:22 pm

    It was just a caching issue…

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

Sidebar

Related Questions

I have two instances of the same database. The first db represents data from
I have two instances of SQLiteDatabase database. And I need to copy data from
I have two instances of an Address.ascx control in an ASP.NET MVC page. <h1>Shipping
I have two instances of NSDate objects, they represent times of start and the
I have two instances of a user control on a page. Both have fields
Ok so I have two instances on a page where I am using Jquery
I have two instances of XElement: var el1 = new System.Xml.Linq.XElement(xel, null); var el2
I am calling Classic ASP Webservices from a .NET application. I have two instances
I have two instances of a model and find that they seem to share
I have two instances of VS2010 running on same machine.One VS instance has a

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.