sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Advanced filters disappear after filtering #3347

Closed clytemnestra closed 9 years ago

clytemnestra commented 9 years ago

Hi, I've described the issue here, as well.

I've installed Sonata Admin Bundle in my Symfony2 project. Here is my composer.json's require:

    "require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.7.*",
    "doctrine/orm": "~2.2,>=2.2.3,<2.5",
    "doctrine/dbal": "<2.5",
    "doctrine/doctrine-bundle": "~1.4",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~4.0",
    "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "doctrine/doctrine-migrations-bundle": "^1.0",
    "friendsofsymfony/user-bundle": "~2.0@dev",
    "cunningsoft/chat-bundle": "^0.4.0",
    "knplabs/knp-time-bundle": "^1.3",
    "knplabs/knp-paginator-bundle": "^2.4",
    "knplabs/knp-menu-bundle": "~2",
    "twig/extensions": "^1.3",

    "sonata-project/core-bundle": "^2.3",
    "sonata-project/block-bundle": "^2.3.8",
    "sonata-project/admin-bundle": "dev-master",
    "sonata-project/doctrine-orm-admin-bundle": "^2.3"
},

I'm using the dev-master version, but this issue seems to appear for the 2.3 version, too.

I have some posts made by users, and whenever I want to use advanced filters to filter something, the advanced filters disappear after filtering, but if I recheck the 'advanced filters' link, they appear with the value inside.

This happens in both dev-master and 2.3 version, and it happens on all entities, not just this one.

I've checked the Sonata Sandbox demo and this doesn't happen there. How come? Is it a setting that enables this? Or is it a certain version? How to make the advanced filters stay visible after filtering?

Before filtering, I add a filter by 'Details'

image

After filtering, the advanced filter box disappears:

image

But if I press 'Advanced filters' link again, it will appear and still have the 'does not contain' option selected.

whitewhidow commented 9 years ago

same here :

/* Advanced filters */
if (jQuery('.advanced-filter :input:visible', subject).filter(function () {     return jQuery(this).val() }).length === 0) {
    jQuery('.advanced-filter').hide();
};

I have no clue why they are doing this ...

It occurs in vendor/sonata-project/admin-bundle/Resources/public/Admin.js

pulzarraider commented 9 years ago

@clytemnestra @whitewhidow thank you for reporting the issue. Can you please test PR #3359?