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

Export of Data: column sorting and title #264

Open
siven-xtn opened this issue Aug 4, 2020 · 2 comments
Open

Export of Data: column sorting and title #264

siven-xtn opened this issue Aug 4, 2020 · 2 comments

Comments

@siven-xtn
Copy link

Q A
Bug? yes
New Feature? no

Actual Behavior

When exporting the data of the submissions, the order of the columns is not the same as the order of the fields on the form and the title of the columns is not the title of the fields.

Expected Behavior

We would expect the columns in the export file to be in the same order as the fields on the form and also expect to see the title (not the name) of the fields as the column headings.

Steps to Reproduce

  • Create a form with multiple fields and multiple type of fields (text, textarea, name, and upload)
  • Make several submission of the form
  • Export the data of the form in a CSV fiel

Possible Solutions

Use the display order of the fields to order the columns in the export file and use the field title (instead of field) name as the column headings.

@alexander-schranz
Copy link
Member

alexander-schranz commented Aug 4, 2020

expect to see the title (not the name)

This is currently the case of every sulu csv export. The idea behind is that it is not language specific so it can be processed by the other system. If it would use the translated title the keys would change and you would have problems to process it in this systems. So I don't think that we can change this behaviour, as it would be a BC Break. You could create a issue on the sulu/sulu repository for this so it can be discussed there as this is the case for all csv export in sulu e.g. contacts, organisations, ....

to be in the same order as the fields on the form

That should be the case the form it is just itereated over the getFields function in DynamicListBuilder or DynamicListFactory like its done when the form is builded in the FormType so the order should be the same in all cases. Maybe you could debug it there to check what is going wrong in your case.

@rogamoore
Copy link

@alexander-schranz I just looked into the sorting problem and actually the getFields method here https://github.com/sulu/SuluFormBundle/blob/2.5/Entity/Dynamic.php#L148 and the call to $this->form->getFields() return the fields just in database order.

In the FormController the fields are being sorted afterwards https://github.com/sulu/SuluFormBundle/blob/2.5/Controller/FormController.php#L396, so we could either do just the same in DynamicListBuilder or add a getFieldsSorted method to avoid repeating code or make this just the default.

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

No branches or pull requests

3 participants