Forum OpenACS Q&A: Changing the sort order of a keys in a tree using tree sortkey

Hello All,

I am building a sitemap utility that allows one to create a tree of nodes. The underlying implementation uses the tree sortkey functionality.

I am unable to find any easy way of changing the sort order of particular tree items other then deleting and recreating the items.

example:
Root
  Node 1
  Node 2
    Sub Node 1
    Sub Node 2
    Sub Node3
  Node 3

needs to be changed to

Root
  Node 2
    Sub Node 2
    Sub Node 1
    Sub Node3
  Node 3
  Node 1

Any ideas?

Regards,
Hafeez

Hafeez.

Did you install the "categories" module on your system? It does what you are looking I think

Cheers
Ben

categories use a different technique to store tree relationships.
There was a posting on how to do this a while ago. It's messy, but I think you have to do it in Tcl. The posting was very helpful, however.
Hi Hafeez,

Its is possible to do this, but I discourage you do to this unless there is no other way. You can use etp as a sample.

Here are some of the older code I got. It maybe possible that they are too old, that its pre bit varying days.

http://cvs.openacs.org/cvs/openacs-4/contrib/packages/bcms-ui-wizard/www/item-sort-swap.tcl?rev=1.1&view=markup

Good luck.