[TYPO3-formidable] renderlet:LISTER - Wrong sort order - Columns with numeric values get sorted wrong. I.e. 1, 15, 2, 3 instead of 1, 2, 3, 15

Uwe Schmelzer us at dvschmelzer.de
Wed Apr 21 05:31:04 CEST 2010


Hi Jerome,

You might give that one a try, whenever you may find the time, of course.

1. Found a very simple solution!
------------------------------------------------------------
asort() could be replaced by natsort()
arsort() could be replaced by natsort() and array_reverse

Big Advantage:
It works without additional sorting information in
/columns/column/sort_mode


2. What to update
------------------------------------------------------------
FILE EXT:ameos_formidable/api/base/ds_phparray/api/class.tx_dsphparray.php
LINE 58 ff

ORIGINAL CODE

if($this->aConfig["sortdirection"] === "desc") {
	arsort($named_hash, $flags=0);
} else {
	asort($named_hash, $flags=0);
}


SUGGESTED CODE

if($this->aConfig["sortdirection"] === "desc") {
	natsort($named_hash);
	$named_hash = array_reverse($named_hash);

} else {
	natsort($named_hash);
}



cheers
uwe schmelzer


More information about the TYPO3-project-formidable mailing list