PDA

View Full Version : XML sorting issue



Ganadai
April 26th, 2006, 01:36
Anyone know why this code is sorting my spells?



<windowclass name="spelllist">
<datasource name="spells" />
<frame name="referencebox" />
<dynamic resize="vertical" />
<defaultsize width="640" height="550" />
<minimize icon="minimized_reference" />
<tooltip field="description" />
<sheetdata>
<windowopencontrol>
<icon normal="button_dragtarget" />
<bounds rect="25,20,20,20" />
<class name="spelllist" />
<description field="description" />
</windowopencontrol>
<stringcontrol name="description">
<bounds rect="50,20,-25,20" />
</stringcontrol>
<windowlist class="spellsmall">
<bounds rect="35,48,-20,-22" />
<nestdata />
</windowlist>
<scroller>
<bounds rect="-63,-45,45,27" />
<target name="list" />
<button normal="button_scroller" pressed="button_scroller_down" />
</scroller>
</sheetdata>
</windowclass>

Toadwart
April 26th, 2006, 10:12
I doubt this has anything to do with the sorting but the scroller is not linked to the windowlist. The windowlist needs a name as below:


<windowlist class="spellsmall" name="list" >
<bounds rect="35,48,-20,-22" />
<nestdata />
</windowlist>
<scroller>
<bounds rect="-63,-45,45,27" />
<target name="list" />
<button normal="button_scroller" pressed="button_scroller_down" />
</scroller>


Without a specific sort node in the windowlist the spells should be appearing in the order that the spell nodes have been defined in the xml (which is in alphabetical order?)

Ganadai
April 26th, 2006, 14:45
Without a specific sort node in the windowlist the spells should be appearing in the order that the spell nodes have been defined in the xml (which is in alphabetical order?)

No, they are not in alphabetical order. If they were in alphabetical order how could I tell that it was sorting them? :)

Since it referances spellsmall could something there be sorting it?



<windowclass name="spellsmall">
<datasource name="spell" />
<defaultsize width="600" height="20" />
<sheetdata>
<windowopencontrol name="open">
<icon normal="button_openwindow" pressed="button_emptytarget" />
<bounds rect="8,0,24,24" />
<class name="spelldesc" />
<description field="name" />
</windowopencontrol>
<stringcontrol name="name">
<bounds rect="50,2,300,17" />
<font name="chatfont" />
<link handler="open" />
</stringcontrol>
<stringcontrol name="shortdescription">
<bounds rect="200,2,360,17" />
<font name="chatfont" />
</stringcontrol>
</sheetdata>
</windowclass>

Toadwart
April 28th, 2006, 00:33
Unless there is some default sorting thet FG is applying I can't see why that code would be sorting your spells.
What field is it sorting by? Name? Description?

kalmarjan
April 28th, 2006, 02:02
I beleive the reason everything is getting sorted for you is this:

The xml that is parsed is parsed based on alphabetical order, based on the order of the letters in each node that the window class is referenced to. You can see this clearly when you are looking at encounters in the db.xml files. Even though each "node" has a unique identifier, the parser will sort in ascending alphabetical order. (I.E. 1, 10, 11, 12... 2, 20, 21 etc.)

It can be a pain in the arse sometimes, but if you do not want to have your list sorted in descending order, then you can try and add something to the title to make it so it does not sort.

Hope that helps,

Sandeman

Ganadai
April 28th, 2006, 06:16
Unless there is some default sorting thet FG is applying I can't see why that code would be sorting your spells.
What field is it sorting by? Name? Description?

It is sorting by name.

Ganadai
April 28th, 2006, 06:17
I beleive the reason everything is getting sorted for you is this:

The xml that is parsed is parsed based on alphabetical order, based on the order of the letters in each node that the window class is referenced to. You can see this clearly when you are looking at encounters in the db.xml files. Even though each "node" has a unique identifier, the parser will sort in ascending alphabetical order. (I.E. 1, 10, 11, 12... 2, 20, 21 etc.)

It can be a pain in the arse sometimes, but if you do not want to have your list sorted in descending order, then you can try and add something to the title to make it so it does not sort.

Hope that helps,

Sandeman

LOL why are you always answering my questions? :)
Anyways, thank you, that worked. I just changed the node names to 01, 02, 03, 04...

kalmarjan
April 28th, 2006, 06:32
I am always glad to help... <err> get my post count up! (Legitimately, that is!) :)

Sandeman

BTW, that will work until you get to 100, then the silly issue will start all over again. I wonder if there is a way to put the xml tag <sort="descending" /> ?

Ganadai
April 28th, 2006, 16:02
I am always glad to help... <err> get my post count up! (Legitimately, that is!) :)

Sandeman

BTW, that will work until you get to 100, then the silly issue will start all over again. I wonder if there is a way to put the xml tag <sort="descending" /> ?

That would not help either, I'd need a tag like:
<sort="none" />