[eluser]Niraj Dave[/eluser]
thanks for reply
i am not good in programming and english. when i need to make organization chart, i found ci nested set and jquey. i havu
i have changed some code in function in model: of CI NESTED SET (category_demo).
and adding jquery file.
Code:
function getSubTreeAsHTML($node, $fields = array())
{
$tree_handle = $this->getTreePreorder($node);
$retVal = "";
$i = -1;
while($this->getTreeNext($tree_handle))
{
$ii = $this->getTreeLevel($tree_handle);
/////////
if($i<$ii) { $retVal .= (str_repeat("<ul class=\"org-chart\"><li>", 1 ));}
if($i>$ii) { $retVal .= (str_repeat("</li></ul>", ($i-$ii))).(str_repeat("</li><li>", 1 ));}
if(($i-$ii)== 0) { $retVal .= (str_repeat("</li><li>", 1));}
// print requested fields
$field = reset($fields);
while($field){
$retVal .= "<div style=\"color:red\">".$tree_handle['row'][$field]."</div>" ."\n" ;
$field = next($fields);
}
$i = $ii;
}
$retVal .= (str_repeat("</li></ul>", $this->getTreeLevel($tree_handle)*1));
return $retVal;
}
it works good as i expect.