0

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'

enter image description here

After filtering, the advanced filter box disappears:

enter image description here

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

George Irimiciuc
  • 4,573
  • 8
  • 44
  • 88

1 Answers1

1

It seems this is actually their intended behaviour ???

/* 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

If you where to copy this file into you own bundle (wich has SonataAdminBundle as parent Bundle), and comment the vendor/sonata-project/admin-bundle/Resources/public line, you should get the behavour you are looking for.

Sam Janssens
  • 1,491
  • 1
  • 12
  • 30
  • Wow, you're fast. It sounds strange for me too, to be intended behaviour. – George Irimiciuc Oct 09 '15 at 13:01
  • yea seems really weird to me aswell, it makes no sense, if i put it on equals, i could understand it beeing removed, but if i put it on "greater than", it surely should not disappear – Sam Janssens Oct 09 '15 at 13:04