protected function renderTable($table)
    {
        $array = array();

        foreach ($table->getRows() as $id => $row) {
            $newRow = array(
                'columns'        => $row->getColumns(),
                'metadata'       => $row->getMetadata(),
                'idsubdatatable' => $row->getIdSubDataTable(),
            );

            if ($id == DataTable::ID_SUMMARY_ROW) {
                $newRow['issummaryrow'] = true;
            }

            $subTable = $row->getSubtable();
            if ($this->isRenderSubtables()
                && $subTable
            ) {
                $subTable = $this->renderTable($subTable);
                $newRow['subtable'] = $subTable;
                if ($this->hideIdSubDatatable === false
                    && isset($newRow['metadata']['idsubdatatable_in_db'])
                ) {
                    $newRow['columns']['idsubdatatable'] = $newRow['metadata']['idsubdatatable_in_db'];
                }
                unset($newRow['metadata']['idsubdatatable_in_db']);
            }
            if ($this->hideIdSubDatatable !== false) {
                unset($newRow['idsubdatatable']);
            }

            $array[] = $newRow;
        }
        return $array;
    }