APYDataGridBundle icon indicating copy to clipboard operation
APYDataGridBundle copied to clipboard

Change source's group when exporting?

Open Mopster opened this issue 6 years ago • 3 comments

I'm trying to find a way to specify the source group specifically when an export is happening. We add additional columns in the export by adding those to the default group. But this increases the amount of data being queried from the database even though those columns are not being used on the actual page, only when it's being exported. And our page load time is getting a big hit because of this.

Is there a way to identify the request is an export before the need to initialize the Source to be able to specify 'export' as the group instead of 'default' or any other custom one ? Or any other way to switch groups for exporting ?

(Running 2.2.1)

Mopster avatar Apr 16 '18 07:04 Mopster

What's wrong with

$source = new Entity($gridEntity, $group, $managerName);

when initializing the source?

DonCallisto avatar Jun 21 '18 05:06 DonCallisto

This is actually a question I have too. My need is to be able to have several sets of columns depending on the export available for the same grid. So I would need to be able to identify the export selected in the controller in order to adjust the group when setting up the source. The question therefore is what's the best way to identify the request is an export and how to identify the export?

vialcollet avatar Dec 13 '18 16:12 vialcollet

This is basically how I did it :

        $group = 'default';
        if(isset($request->request->get($gridId)['__export_id'])) {
            $group = 'export';
        }

        $source = new Entity('AcmeBundle:Entity', $group)

Mopster avatar Dec 25 '18 16:12 Mopster