public function handleExport($id)
	{
		if (!isset($this->exports[$id])) {
			throw new Nette\Application\ForbiddenRequestException;
		}

		if (!empty($this->columns_export_order)) {
			$this->setColumnsOrder($this->columns_export_order);
		}

		$export = $this->exports[$id];

		/**
		 * Invoke possible events
		 */
		$this->onExport($this);

		if ($export->isFiltered()) {
			$sort = $this->sort;
			$filter = $this->assembleFilters();
		} else {
			$sort = [$this->primary_key => 'ASC'];
			$filter = [];
		}

		if ($this->dataModel === null) {
			throw new DataGridException('You have to set a data source first.');
		}

		$rows = [];

		$items = Nette\Utils\Callback::invokeArgs(
			[$this->dataModel, 'filterData'], [
				null,
				$this->createSorting($this->sort, $this->sort_callback),
				$filter,
			]
		);

		foreach ($items as $item) {
			$rows[] = new Row($this, $item, $this->getPrimaryKey());
		}

		if ($export instanceof Export\ExportCsv) {
			$export->invoke($rows);
		} else {
			$export->invoke($items);
		}

		if ($export->isAjax()) {
			$this->reload();
		}
	}
public function handleExport($id)
	{
		if (!isset($this->exports[$id])) {
			throw new Nette\Application\ForbiddenRequestException;
		}

		if (!empty($this->columns_export_order)) {
			$this->setColumnsOrder($this->columns_export_order);
		}

		$export = $this->exports[$id];

		/**
		 * Invoke possible events
		 */
		$this->onExport($this);

		if ($export->isFiltered()) {
			$sort = $this->sort;
			$filter = $this->assembleFilters();
		} else {
			$sort = [$this->primary_key => 'ASC'];
			$filter = [];
		}

		if ($this->dataModel === null) {
			throw new DataGridException('You have to set a data source first.');
		}

		$rows = [];

		$items = Nette\Utils\Callback::invokeArgs(
			[$this->dataModel, 'filterData'], [
				null,
				$this->createSorting($this->sort, $this->sort_callback),
				$filter,
			]
		);

		foreach ($items as $item) {
			$rows[] = new Row($this, $item, $this->getPrimaryKey());
		}

		if ($export instanceof Export\ExportCsv) {
			$export->invoke($rows);
		} else {
			$export->invoke($items);
		}

		if ($export->isAjax()) {
			$this->reload();
		}
	}
public function handleExport ( $ id ) { if ( ! isset ( $ this -> exports [ $ id ] ) ) { throw new Nette \ Application \ ForbiddenRequestException ; } if ( ! empty ( $ this -> columns_export_order ) ) { $ this -> setColumnsOrder ( $ this -> columns_export_order ) ; } $ export = $ this -> exports [ $ id ] ; /**
		 * Invoke possible events
		 */ $ this -> onExport ( $ this ) ; if ( $ export -> isFiltered ( ) ) { $ sort = $ this -> sort ; $ filter = $ this -> assembleFilters ( ) ; } else { $ sort = [ $ this -> primary_key => 'ASC' ] ; $ filter = [ ] ; } if ( $ this -> dataModel === null ) { throw new DataGridException ( 'You have to set a data source first.' ) ; } $ rows = [ ] ; $ items = Nette \ Utils \ Callback :: invokeArgs ( [ $ this -> dataModel , 'filterData' ] , [ null , $ this -> createSorting ( $ this -> sort , $ this -> sort_callback ) , $ filter , ] ) ; foreach ( $ items as $ item ) { $ rows [ ] = new Row ( $ this , $ item , $ this -> getPrimaryKey ( ) ) ; } if ( $ export instanceof Export \ ExportCsv ) { $ export -> invoke ( $ rows ) ; } else { $ export -> invoke ( $ items ) ; } if ( $ export -> isAjax ( ) ) { $ this -> reload ( ) ; } }
Handler for export
@param  int $id Key for particular export class in array $this->exports
@return void
Handler for export