sulu/SuluFormBundle

Filter Data and export

Opened this issue · 4 comments

Q A
Bug? no
New Feature? yes
Bundle Version -
Sulu Version 2.1
Browser Version All

Actual Behavior

Currently if you have a lot of contacts on a daily basis and you want to make a daily export you have to download everything for filtering. You can receive it by email but many users prefer direct download.

Expected Behavior

Add filtering possibilities like other sulu entities in order to be able to select more specific filtering.

Which specific filters for the dynamic list data do you want to be implemented to improve your workflow?

Maybe only be able to filter by "created at" which is not a dynamic field.

Like the idea! If I am not mistaken, this should be quite easy to do by adding the respective filters in the list-configuration 🙂

<case-property name="locale">
<field>
<field-name>locale</field-name>
<entity-name>Sulu\Bundle\FormBundle\Entity\FormTranslation</entity-name>
<joins ref="translation"/>
</field>
<field>
<field-name>defaultLocale</field-name>
<entity-name>Sulu\Bundle\FormBundle\Entity\Form</entity-name>
</field>
</case-property>
<property
name="changed"
translation="sulu_admin.changed"
visibility="yes"
type="datetime">
<field-name>changed</field-name>
<entity-name>Sulu\Bundle\FormBundle\Entity\FormTranslation</entity-name>
<joins ref="translation"/>
</property>
<property
name="created"
translation="sulu_admin.created"
visibility="no"
type="datetime">
<field-name>created</field-name>
<entity-name>Sulu\Bundle\FormBundle\Entity\FormTranslation</entity-name>
<joins ref="translation"/>
</property>
</properties>

@nnatter the form data (dynamic entity) list metadata are created in PHP as they have no static structure. I think the filter would need to be added here then:

$fieldDescriptors = $this->dynamicListFactory->getFieldDescriptors($form, $locale);
foreach ($fieldDescriptors as $fieldDescriptor) {
$field = new FieldMetadata($fieldDescriptor->getName());
$field->setLabel($this->translator->trans($fieldDescriptor->getTranslation(), [], 'admin', $locale));
$field->setType($fieldDescriptor->getType());
$field->setVisibility($fieldDescriptor->getVisibility());
$field->setSortable($fieldDescriptor->getSortable());
$list->addField($field);
}

Also the Controller doesn't use the ListBuilder so the filter would need to be implemented there also.