@anonymous-piwik-user opened this Issue on June 21st 2009

If empty result set you cannot retrieve the columns, see modified code below

        /**
         * Returns columns names to display, in order.
         * If no columns were specified to be displayed, return all columns found in the first row.
         * <a class='mention' href='https://github.com/param'>@param</a> array PHP array conversion of the data table
         * <a class='mention' href='https://github.com/return'>@return</a> array
         */
        public function getColumnsToDisplay()
        {
                if(empty($this->columnsToDisplay))
                {
                        $row = $this->dataTable->getFirstRow();
                        if (empty($row))
                                return array();

                        return array_keys($row->getColumns());
                }
                $this->columnsToDisplay = array_filter($this->columnsToDisplay);
                return $this->columnsToDisplay;
        }
@robocoder commented on June 22nd 2009 Contributor

(In [1245]) fixes #820

This Issue was closed on June 22nd 2009
Powered by GitHub Issue Mirror