KoolTreeGrid - Excellent PHP TreeGrid
KoolTreeGrid is an excellent PHP control that combines the strength of tree data with data grid.
A lot of real world data is best represented by tree relation and there are times each data point is best viewed in a grid format.
That's when KoolTreeGrid comes in handy for data representation and manipulation.

Key Features:
  • Fast setup with minimal code.
  • Support at least two types of input data, either a grid or a tree array.
  • Provide many displaying and formatting options for each data point/row.
  • Multiple styles to choose from.
  • Versatile client functions and data API.
  • Support user-interactivity
  • Continously developed and supported.
  • Step by step guides

    <?php
        # Step 1: Import ajax and treegrid classes 
        $KoolControlsFolder = "KoolControls";
        require $KoolControlsFolder."/KoolAjax/koolajax.php";
        require $KoolControlsFolder."/KoolTreeGrid/kooltreegrid.php";
     
        # Step 2: Prepare tree or grid array as data input
        $treeArray = array(
            'row' => array(
                'type' => 'Captain',
                'level' => '1',
            ),
            'children' => array(
                array(
                    'row' => array(
                        'type' => 'Crew member',
                        'level' => '2',
                    ),
                    'children' => array(
                        array(
                            'row' => array(
                                'type' => 'Apprentice',
                                'level' => '3',
                            ),
                        ),
                    ),
                ),
            ),
        );
     
        $gridArray = array(
            array('id' => '1', 'parent' => '' , 'type' => 'Captain', 'level' => '1'),
            array('id' => '2', 'parent' => '1', 'type' => 'Crew member', 'level' => '2'),
            array('id' => '3', 'parent' => '2', 'type' => 'Apprentice', 'level' => '3'),
        );
     
     
        # Step 3: Create a tree grid using either the tree or grid data and some setting, then process
        $treeGrid = KoolTreeGrid::newTreeGrid(array(
            'id' => 'KoolTreeGrid1',
            'TreeArray' => $treeArray,
            //'ArrayData' => $gridArray,
            'idField' => 'id',
            'parentField' => 'parent',
            'columns' => array(
                array(
                    'field' => 'type',
                ),
                array(
                    'field' => 'level',
                ),
            ),
        ));
        $treeGrid->Process();
    ?>
    <html>
        <head></head>
        <body>
            <?php 
                <!-- Step 5: Render the ajax and treegrid controls -->
                echo $koolajax->Render();
                echo $treeGrid->Render();
            ?>
        </body>
    </html>