When we use jgGrid, like this:
get_items.php =>
$SQL = "SELECT * FROM items ORDER BY $sidx $sord LIMIT $start , $limit";
//$sidx is the index row.
//ie. $sidx = 'name';
$result = $mysql->query( $SQL );
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
...
//balah balah
...
while ( $row = $mysql->fetch_array( $result ) ) {
...
//Note the getName method.
$s .= "<cell>". getName($row['name']))."</cell>";
...
};
echo $s;
function getName ( name ) {
if ( name == 'Lane' ) return 'Brian Lane';
if ( name == 'Kerwin' ) return 'Diane Kerwin';
...
...
}
Now the question is :
if I sort the jqGrid by ASC, it will show like Diane Kerwin, Brian Lane
as Kerwin
is before Lane
.
How to sort the fields like Brian Lane, Diane Kerwin
by ASC?