luyadev / luya-module-admin

Administration base module for all LUYA admin modules
https://luya.io
MIT License
48 stars 56 forks source link

Default Filter(s) #502

Open siripravi opened 4 years ago

siripravi commented 4 years ago

What steps will reproduce the problem?

I have defined these filters in my NgModel: public function ngRestFilters() { return [ 'Deleted' => self::find()->where(['=', 'is_deleted', 1]), 'Active' => self::find()->where(['=', 'is_deleted', 0]), ]; }

What is the expected result?

I want to show 'Active' Items by default. Is it possible to set some filter as default?

What do you get instead? (A Screenshot can help us a lot!)

LUYA Check ouput (run this script and post the result: luyacheck.php)

Additional infos

Q A
LUYA Version
PHP Version
Platform Apache/XAMPP/MAMPP/etc.
Operating system Windows/Linux Server/OSX/etc.
nadar commented 4 years ago

Its not possible, but if you have selected a filter, it will be stored in the user settings and will be the default filter for your account. does that help?

siripravi commented 4 years ago

Sure. It would be helpful. Is it automatic? How to do it? Any documentation on this?

nadar commented 4 years ago

Its not available yet, but we can add this feature :+1: should not be to hard to develop.

siripravi commented 4 years ago

Its not filter on just one single field. We should be able to have something called a 'Filter Group', that should hold a set of filters(with search criteria) on several fields. The user should be able to use(apply) one or more of these filter groups to the list view. Possibly we can show these filter groups as a dropdown list or a button group etc.

nadar commented 4 years ago

but this is not the topic you mentioned in the start of the issue?

siripravi commented 4 years ago

Yes. What I mentioned was an enhancement to the previous requirement. I first talked about default filter criteria on one field only.

nadar commented 4 years ago

Well, filters can have as much criterias as you like, its a where condition. But maybe you like to use Tags, then you can also filter by tags.

siripravi commented 4 years ago

Exactly. I dont know how feasible this requirement is, but would be helpful.

siripravi commented 4 years ago

Sure.

nadar commented 4 years ago

@siripravi You can already use tags to filter data, just add the TaggableTrait trait and TaggableActiveWindow and you are done.