Ticket #1128: DataTable.php.diff

File DataTable.php.diff, 2.5 KB (added by jetuelle, 2 years ago)

The diff file of DataTable.php

  • DataTable.php

     
    147147         */ 
    148148        protected $currentId; 
    149149         
     150        protected $nextRowId = 0;//new added 
     151         
     152         
    150153        /** 
    151154         * Current depth level of this data table 
    152155         * 0 is the parent data table 
     
    160163         *  
    161164         * @var bool 
    162165         */ 
    163         protected $indexNotUpToDate = true; 
     166        //protected $indexNotUpToDate = true; 
    164167         
    165168        /** 
    166169         * This flag sets the index to be rebuild whenever a new row is added,  
     
    170173         *  
    171174         * @var bool 
    172175         */ 
    173         protected $rebuildIndexContinuously = false; 
     176        //protected $rebuildIndexContinuously = false; 
    174177         
    175178        /** 
    176179         * Column name of last time the table was sorted 
     
    252255         */ 
    253256        public function sort( $functionCallback, $columnSortedBy ) 
    254257        { 
    255                 $this->indexNotUpToDate = true; 
     258                //$this->indexNotUpToDate = true; 
    256259                $this->tableSortedBy = $columnSortedBy; 
    257260                usort( $this->rows, $functionCallback ); 
    258261                 
     
    414417         */ 
    415418        public function getRowFromLabel( $label ) 
    416419        { 
    417                 $this->rebuildIndexContinuously = true; 
     420    /*  $this->rebuildIndexContinuously = true; 
    418421                if($this->indexNotUpToDate) 
    419422                { 
    420423                        $this->rebuildIndex(); 
    421424                } 
    422                  
     425        */       
    423426                if($label === self::LABEL_SUMMARY_ROW 
    424427                        && !is_null($this->summaryRow)) 
    425428                { 
     
    437440        /** 
    438441         * Rebuilds the index used to lookup a row by label 
    439442         */ 
     443          
     444        /* 
    440445        private function rebuildIndex() 
    441446        { 
    442447                foreach($this->rows as $id => $row) 
     
    449454                } 
    450455                $this->indexNotUpToDate = false; 
    451456        } 
    452  
     457         */ 
    453458        /** 
    454459         * Returns the ith row in the array 
    455460         * 
     
    496501         */ 
    497502        public function addRow( Piwik_DataTable_Row $row ) 
    498503        { 
    499                 $this->rows[] = $row; 
    500                 if(!$this->indexNotUpToDate 
    501                         && $this->rebuildIndexContinuously) 
    502                 { 
     504                $this->rows[] = $row;            
     505                //if(!$this->indexNotUpToDate 
     506                //      && $this->rebuildIndexContinuously) 
     507                //{ 
    503508                        $label = $row->getColumn('label'); 
    504509                        if($label !== false) 
    505510                        { 
    506                                 $this->rowsIndexByLabel[$label] = count($this->rows)-1; 
     511                                //$this->rowsIndexByLabel[$label] = count($this->rows)-1; 
     512                                $this->rowsIndexByLabel[$label] = $this->nextRowId; 
     513                                $this->nextRowId++; 
    507514                        } 
    508515                        $this->indexNotUpToDate = false; 
    509                 } 
     516                //} 
    510517        } 
    511518 
    512519        /** 
     
    816823                $rows1 = $table1->getRows(); 
    817824                $rows2 = $table2->getRows(); 
    818825                 
    819                 $table1->rebuildIndex(); 
    820                 $table2->rebuildIndex(); 
     826                //$table1->rebuildIndex(); 
     827                //$table2->rebuildIndex(); 
    821828                 
    822829                if($table1->getRowsCount() != $table2->getRowsCount()) 
    823830                {