CTreeView 用於顯示具階層結構的資料,透過設定 data 屬性。data 為具有以下結構的陣列:
text:樹節點文字expanded:可選,節點是否展開id:可選,節點 IDhasChildren:可選,預設 false,true 表示含子節點children:可選,子節點陣列htmlOptions:HTML 選項尚未介紹資料庫存取,故使用硬編碼資料:
array(
'text' => '<a id="27" href="#">World:4</a>',
'id' => '27',
'hasChildren' => true,
'children' => array(
array(
'text' => '<a id="1" href="#">Europa:3</a>',
'id' => '1',
'hasChildren' => true,
'children' => array(
array(
'text' => '<a id="3" href="#">Germany:3</a>',
'id' => '3',
'hasChildren' => true,
'children' => array(
array('text' => '<a id="15" href="#">Munich:0</a>', 'id' => '15', 'hasChildren' => false),
array('text' => '<a id="16" href="#">Stuttgart:0</a>', 'id' => '16', 'hasChildren' => false),
array('text' => '<a id="5" href="#">Berlin:0</a>', 'id' => '5', 'hasChildren' => false)
)
),
// ... 更多節點 ...
)
)
)
)