Filtering in data grid

0
Hello mendix makers, I need a filter for a table (something like excel), If I use Grid1, I can filter, but the customer must write exactly what he wants to filter. I need to filter according to several criteria, it would be good if it had a selection (something like a dropdown) so that you could choose from the list. I am using version 10.1.1. Can you help me with this? thanks for any advice.
asked
4 answers
1

Hello Petra,

 

It depends on which kind of attribute types you have what is possible and what is not possible.

For example date fields can be searched in way different way than text fields or numbers.

But luckily there is a lot possible with the data connectors that mendix offers.

For example with datagrid 2  you can specify what kind of filter you want for which column and even in the front end choose which kind of filtering you want to do exact or on contains for example:

 

many options are described here:

 

https://docs.mendix.com/appstore/modules/data-grid-2/

 

hope this helps,

 

Good luck

 

PS: If you provide more exact information about what kind of datasource you use and what kind of fields you want to search one we can probably help you more

answered
0

Hey Petra,

Do you wanna have something like this where user have predefined filter like this, where based on selected filter it's will automatically show columns and fill values from predefined filter?

image.png

answered
0

No, I have attributes: Chapter Name, Position, SSP, SSP seniority

As a user, I want to see in the "Chapter" filter list of chapter names that I can filter(I don't need to know the exact name because I can choose from a list).  I can choose one. In the second filter 'Position' I want to see all Position and I can choose one. And 3rd filter with 'SSP'. Finally, I will see 3 records. 

image.png

answered
0

In the case you described, you don't need Datagrid2 (but you can still use it if you prefer), rather you need custom logic for searching. Since you want to have a dropdown with an autocomplete widget (I don't need to know the exact name because I can choose from a list - based on this comment and on the marketplace, you have a bunch of them, even on Mendix 10, you already have that kind of widget integrated forgot the name of it), the only challenging thing is how you want to group Chapter, Position, and SPP. I suppose they can be dynamically created, and then you can use an object (create entity)t for each Chapter, Position, and SPP. You need to create an object or there is no other way to show all possible filters in the dropdown without duplication in dropdown list (if I'm wrong or if there is a widget that can group strings, please let me know).

Your page should have the following order: Dataview- with a non-persistent (or pesistent if you will have problem with associating one helper to multiple Chapter, Position and SPP) helper object where you can associate it with the objects of Chapter, Position, and SPP. Inside the DataView, you just show the ListView with a datasource microflow, where you can then easily filter through your list based on input of association of Helper object.

 

Best regards, Slavko

answered