Perspective Tree ordering

I have a question about a feature I'm implementing using a Perspective Tree component. Here is a picture of the problem:
image

I would like it to show up in this way:
image

(obviously extrapolated for any number of nodes in the tree).

Here are the paths for each node:

  • root: '123'
  • TH123: '123$TH123'
  • RT124: '123$234'
  • RT345: '123$234$345'

The problem: Notice that RT345's path comes from 234, but it shows up in the Tree under TH123... why?????

I don't want the RT nodes to attach to the TH nodes BUT at the same time, I want the TH nodes to display first (meaning right under the parent nodes).

All of the IDs are coming from two different tables in the database (TH and RT).The reason why I prepended the TH to the TH ID in the database is because there will be that one time where the TH.ID = RT.ID that will wreck me when I have to troubleshoot this in a year or two.

TIA

I hope everyone who reads this post gets amnesia and forgets that I posted it. In the recursive procedure that I'm using to fetch from both tables, I mixed one ID for another, which then wasn't specific enough in the shared script I'm using to transform the dataset to JSON. This wouldn't be an issue, besides that I'm forcing the TH records to appear first, so then all of the children attach to it instead of where they should. I found this out during step by step debugging of that function that it wasn't the problem.

I hate recursion.

3 Likes

A thousand points for not being a DenverCoder9:

4 Likes