Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change source's group when exporting? #1006

Open
Mopster opened this issue Apr 16, 2018 · 3 comments
Open

Change source's group when exporting? #1006

Mopster opened this issue Apr 16, 2018 · 3 comments
Labels

Comments

@Mopster
Copy link

Mopster commented Apr 16, 2018

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)

@DonCallisto
Copy link
Member

What's wrong with

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

when initializing the source?

@vialcollet
Copy link

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?

@Mopster
Copy link
Author

Mopster commented Dec 25, 2018

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants