Welcome Guest, Not a member yet? Register   Sign In
nested hierarchical view: using Jquery and CI_Nested_Sets
#1

[eluser]Niraj Dave[/eluser]
hi everybody,

i have made hierarchical chart view to display company structure view using CI_NESTED_SETS library and jquiery treebuilder.


i just changed code of function "getSubTreeAsHTML" with below code. and i installed all doc file of ci and treebuilder lib. as per instruction. i found good result.

if you found any error in this code so please let me know. :bug:

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;

    }
#2

[eluser]jedd[/eluser]
Please don't revive any other old threads with pointers back to this one.
#3

[eluser]Niraj Dave[/eluser]
Sorry! about that & thanks for reply




Theme © iAndrew 2016 - Forum software by © MyBB