Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Tree Views + Loadarray (https://forums.graalonline.com/forums/showthread.php?t=67651)

KuJi 07-27-2006 08:37 PM

Tree Views + Loadarray
 
In a textfile, I have this:

PHP Code:

Leader=Leader
Leader.1
=KuJi
Leader
.Generals=Generals
Leader
.Generals.1=General1
Leader
.Generals.1.1=Test1
Leader
.Generals.2=General2
Leader
.Generals.2.1=Test1
Leader
.Generals.2.2=Test2
Leader
.Generals.3=General3
Leader
.Generals.3.1=Test1
Leader
.Generals.3.2=Test2
Leader
.Generals.3.3=Test3 

On serverside, I load the text file to an object, then save it as an array and trigger it to the clientside.

PHP Code:

this.gang_ranks = new TStaticVar(); 
this.gang_ranks.clear();
this.gang_ranks.loadvars("/gangs/" params[1] @ "_ranks.txt");  
temp.rankholder this.gang_ranks.savevarstoarray(true); 

Then I load it in a tree. Only thing is temp.rankholder doesn't keep the same sort order as the text file and it mixes up the order of the ranks which in the tree view mess it up. So I couldn't find out why, so I tried to find a way to get the treenodes to sort and I can't get that to work either. If you know how to make the vars not sort, or you know how to sort treenodes please help :o

Admins 07-27-2006 11:57 PM

For the tree view you set attributes like this:

sortmode = "value";
sortorder = "descending";
groupsortorder = "ascending";

For the nodes then:

sortvalue = 1;
sortgroup = 2;

That would sort the nodes after the value you have assigned to them. When you set sortmode="name" then it will be sorted alphabetically. The sort group can be used to let some types of nodes always appear at the top, e.g. in a folder view you would want to display the folders at the top.

KuJi 07-28-2006 12:11 AM

Quote:

Originally Posted by Stefan
For the tree view you set attributes like this:

sortmode = "value";
sortorder = "descending";
groupsortorder = "ascending";

For the nodes then:

sortvalue = 1;
sortgroup = 2;

That would sort the nodes after the value you have assigned to them. When you set sortmode="name" then it will be sorted alphabetically. The sort group can be used to let some types of nodes always appear at the top, e.g. in a folder view you would want to display the folders at the top.

It would be easier for me if the objects when loaded to an array didn't mix up though. I don't think ascending/descending will make the object look as it should originally :o


All times are GMT +2. The time now is 06:46 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.