正如PaulF所指出的,您需要使用
JOIN或子查询从同一张表中检索父亲的名字。
我假设您是
ssp.class.php根据您提到的示例在服务器端处理数据的。
类
ssp.class.php不支持联接和子查询,但是有一种解决方法。诀窍是使用
$table定义如下所示的子查询。
table在子查询中替换为您的实际表名。
$table = <<<EOT ( SELECt a.id, a.name, a.father_id, b.name AS father_name FROM table a LEFT JOIN table b ON a.father_id = b.id ) tempEOT;$primaryKey = 'id';$columns = array( array( 'db' => 'id', 'dt' => 0 ), array( 'db' => 'name', 'dt' => 1 ), array( 'db' => 'father_id', 'dt' => 2 ), array( 'db' => 'father_name', 'dt' => 3 ));$sql_details = array( 'user' => '', 'pass' => '', 'db' => '', 'host' => '');require( 'ssp.class.php' );echo json_enpre( SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns ));
您还需要编辑
ssp.class.php和替换的所有实例
FROM$table
`与FROM $table`删除反引号。
确保所有列名都是唯一的,否则用于
AS分配别名。
笔记
还有github.com/emran/ssp存储库,其中包含增强的
ssp.class.php支持JOIN。
链接
有关更多信息,请参见jQuery数据表:将WHERe,JOIN和GROUP
BY与ssp.class.php一起使用。



