--- C:/DOCUME~1/WUT~1.CSI/LOCALS~1/Temp/DataTable.p-revBASE.svn002.tmp.php 星期一 二月 22 11:12:38 2010 +++ C:/Documents and Settings/wut.CSIP-0310117/My Documents/piwik-new/DataTable.php 星期一 二月 22 11:01:45 2010 @@ -147,6 +147,9 @@ */ protected $currentId; + protected $nextRowId = 0;//new added + + /** * Current depth level of this data table * 0 is the parent data table @@ -160,7 +163,7 @@ * * @var bool */ - protected $indexNotUpToDate = true; + //protected $indexNotUpToDate = true; /** * This flag sets the index to be rebuild whenever a new row is added, @@ -170,7 +173,7 @@ * * @var bool */ - protected $rebuildIndexContinuously = false; + //protected $rebuildIndexContinuously = false; /** * Column name of last time the table was sorted @@ -252,7 +255,7 @@ */ public function sort( $functionCallback, $columnSortedBy ) { - $this->indexNotUpToDate = true; + //$this->indexNotUpToDate = true; $this->tableSortedBy = $columnSortedBy; usort( $this->rows, $functionCallback ); @@ -414,12 +417,12 @@ */ public function getRowFromLabel( $label ) { - $this->rebuildIndexContinuously = true; + /* $this->rebuildIndexContinuously = true; if($this->indexNotUpToDate) { $this->rebuildIndex(); } - + */ if($label === self::LABEL_SUMMARY_ROW && !is_null($this->summaryRow)) { @@ -437,6 +440,8 @@ /** * Rebuilds the index used to lookup a row by label */ + + /* private function rebuildIndex() { foreach($this->rows as $id => $row) @@ -449,7 +454,7 @@ } $this->indexNotUpToDate = false; } - + */ /** * Returns the ith row in the array * @@ -496,17 +501,19 @@ */ public function addRow( Piwik_DataTable_Row $row ) { - $this->rows[] = $row; - if(!$this->indexNotUpToDate - && $this->rebuildIndexContinuously) - { + $this->rows[] = $row; + //if(!$this->indexNotUpToDate + // && $this->rebuildIndexContinuously) + //{ $label = $row->getColumn('label'); if($label !== false) { - $this->rowsIndexByLabel[$label] = count($this->rows)-1; + //$this->rowsIndexByLabel[$label] = count($this->rows)-1; + $this->rowsIndexByLabel[$label] = $this->nextRowId; + $this->nextRowId++; } $this->indexNotUpToDate = false; - } + //} } /** @@ -816,8 +823,8 @@ $rows1 = $table1->getRows(); $rows2 = $table2->getRows(); - $table1->rebuildIndex(); - $table2->rebuildIndex(); + //$table1->rebuildIndex(); + //$table2->rebuildIndex(); if($table1->getRowsCount() != $table2->getRowsCount()) {