RapidApp

 view release on metacpan or  search on metacpan

lib/RapidApp/Module/Grid/Role/ExcelExport.pm  view on Meta::CPAN

	
	# Restrict columns to the set we chose to keep.
	# Note that the previous ref is a constant, and would be bad if we modified it.
	$columns= [ map { $_->{name} } @colDefs ];

	# override the columns that DataStore is fetching
	#$self->c->req->params->{columns}= $self->json->encode($columns);
	my $data = $self->DataStore->read({%$params, columns => $columns, ignore_page_size => 1});

	# TODO: We just read all rows into memory, and now we're building the file in memory as well.
	# We would do well to replace this with a db-cursor-to-tempfile streaming design
	
	my $dlData = '';
	open my $fd, '>', \$dlData;
	
	my $method= $export_format->{renderer};
	$self->$method({ %$params, col_defs => \@colDefs }, $data, $fd);
	
	close $fd;

	$self->render_as_json(0);



( run in 0.229 second using v1.01-cache-2.11-cpan-4d50c553e7e )