Ticket #1128: DataTable.php.diff
| File DataTable.php.diff, 2.5 KB (added by jetuelle, 2 years ago) |
|---|
-
DataTable.php
147 147 */ 148 148 protected $currentId; 149 149 150 protected $nextRowId = 0;//new added 151 152 150 153 /** 151 154 * Current depth level of this data table 152 155 * 0 is the parent data table … … 160 163 * 161 164 * @var bool 162 165 */ 163 protected $indexNotUpToDate = true;166 //protected $indexNotUpToDate = true; 164 167 165 168 /** 166 169 * This flag sets the index to be rebuild whenever a new row is added, … … 170 173 * 171 174 * @var bool 172 175 */ 173 protected $rebuildIndexContinuously = false;176 //protected $rebuildIndexContinuously = false; 174 177 175 178 /** 176 179 * Column name of last time the table was sorted … … 252 255 */ 253 256 public function sort( $functionCallback, $columnSortedBy ) 254 257 { 255 $this->indexNotUpToDate = true;258 //$this->indexNotUpToDate = true; 256 259 $this->tableSortedBy = $columnSortedBy; 257 260 usort( $this->rows, $functionCallback ); 258 261 … … 414 417 */ 415 418 public function getRowFromLabel( $label ) 416 419 { 417 $this->rebuildIndexContinuously = true;420 /* $this->rebuildIndexContinuously = true; 418 421 if($this->indexNotUpToDate) 419 422 { 420 423 $this->rebuildIndex(); 421 424 } 422 425 */ 423 426 if($label === self::LABEL_SUMMARY_ROW 424 427 && !is_null($this->summaryRow)) 425 428 { … … 437 440 /** 438 441 * Rebuilds the index used to lookup a row by label 439 442 */ 443 444 /* 440 445 private function rebuildIndex() 441 446 { 442 447 foreach($this->rows as $id => $row) … … 449 454 } 450 455 $this->indexNotUpToDate = false; 451 456 } 452 457 */ 453 458 /** 454 459 * Returns the ith row in the array 455 460 * … … 496 501 */ 497 502 public function addRow( Piwik_DataTable_Row $row ) 498 503 { 499 $this->rows[] = $row; 500 if(!$this->indexNotUpToDate501 && $this->rebuildIndexContinuously)502 {504 $this->rows[] = $row; 505 //if(!$this->indexNotUpToDate 506 // && $this->rebuildIndexContinuously) 507 //{ 503 508 $label = $row->getColumn('label'); 504 509 if($label !== false) 505 510 { 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++; 507 514 } 508 515 $this->indexNotUpToDate = false; 509 }516 //} 510 517 } 511 518 512 519 /** … … 816 823 $rows1 = $table1->getRows(); 817 824 $rows2 = $table2->getRows(); 818 825 819 $table1->rebuildIndex();820 $table2->rebuildIndex();826 //$table1->rebuildIndex(); 827 //$table2->rebuildIndex(); 821 828 822 829 if($table1->getRowsCount() != $table2->getRowsCount()) 823 830 {
