getEmptyClone() public method

Returns an empty DataTable with the same metadata and queued filters as $this one.
public getEmptyClone ( boolean $keepFilters = true ) : DataTable
$keepFilters boolean Whether to pass the queued filter list to the new DataTable or not.
return DataTable
Example #1
0
 /**
  * Template method called from self::manipulate.
  * Flatten each data table.
  *
  * @param DataTable $dataTable
  * @return DataTable
  */
 protected function manipulateDataTable($dataTable)
 {
     $newDataTable = $dataTable->getEmptyClone($keepFilters = true);
     // this recursive filter will be applied to subtables
     $dataTable->filter('ReplaceSummaryRowLabel');
     $this->flattenDataTableInto($dataTable, $newDataTable);
     return $newDataTable;
 }
Example #2
0
 /**
  * Template method called from self::manipulate.
  * Flatten each data table.
  *
  * @param DataTable $dataTable
  * @return DataTable
  */
 protected function manipulateDataTable($dataTable)
 {
     // apply filters now since subtables have their filters applied before generic filters. if we don't do this
     // now, we'll try to apply filters to rows that have already been manipulated. this results in errors like
     // 'column ... already exists'.
     if (Common::getRequestVar('disable_queued_filters', 0, 'int', $this->request) == 0) {
         $dataTable->applyQueuedFilters();
     }
     $newDataTable = $dataTable->getEmptyClone($keepFilters = false);
     foreach ($dataTable->getRows() as $row) {
         $this->flattenRow($row, $newDataTable);
     }
     return $newDataTable;
 }
Example #3
0
 private function makeCloneOfDataTableSites(DataTable $sites)
 {
     $sitesByGroup = $sites->getEmptyClone(true);
     // we handle them ourselves for faster performance etc. This way we also avoid to apply them twice.
     $sitesByGroup->disableFilter('ColumnCallbackReplace');
     $sitesByGroup->disableFilter('MetadataCallbackAddMetadata');
     return $sitesByGroup;
 }