【发布时间】:2011-07-13 04:45:01
【问题描述】:
当我们使用jgGrid时,像这样:
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';
...
...
}
现在的问题是:
如果我按 ASC 对 jqGrid 进行排序,它将显示为 Diane Kerwin, Brian Lane,因为 Kerwin 在 Lane 之前。
Brian Lane, Diane Kerwin等字段如何按ASC排序?
【问题讨论】: