marqu3s / yii2-behaviors

Collection of Yii2 Behaviors to enhance Grids and ActiveRecord models.
MIT License
11 stars 4 forks source link

can't apply default filters #7

Closed ghpeppe closed 2 months ago

ghpeppe commented 6 years ago

Usually, to apply default filter condition to the grid you just insert a row before the "load" command with the needed values:

        $this->doc_ruolo = 'PA';
        $this->load($params); // "loadWithFilters" in the case

This method doesn't run with the extension and the defined filters were ignored. How can I achieve the goal?

ghpeppe commented 6 years ago

The above code is right; there was a mistake in the "rules" function. Btw the problem is not solved.

I think the default filters would be removed only when the user sets something different on that field. It seems this is not a problem specific for this extension but the yii platform; however adding a default filter managing to the extension would be a good thing.

marqu3s commented 6 years ago

Hi! I’ve been very busy but I’ll take a look as soon as possible.

Atenciosamente, João Marques Em 31 de out de 2018 05:15 -0300, Peppe notifications@github.com escreveu:

The above code is right; there was a mistake in the "rules" function. Btw the problem is not solved.

• The code sets a default filter on field X and it's applied opening the grid. • When I manually set a filter on grid's field Z it's applied correctly too, but the filter on field X is removed. I think the default filters would be removed only when the user sets something different on that field. It seems this is not a problem specific for this extension but the yii platform; however adding a default filter managing to the extension would be a good thing.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

marqu3s commented 2 months ago

Sorry for return back to you at that time. Closing this since it was posted a long time ago.