Data Grid 2 Filters

Hello,   I've a data grid 2 and I need some filters, but I wnat make it in Filters Placeholder, I nedd filter by name (is text), by role (is a dropdown), by type (dropdown) and by status (dropdown)... I've got filters inside a groupbox, but all dropdowns have the same value   I configured "Grid wide filtering"   How can I resolve this?
3 answers

Hi Andre, 


I can imagine what you mean as the column filters can be quite in your face. However there is a possibility to hide them by default, and only show them when you click a button, which is explained in the following post. You will have to add a Non-persistant UI entity and some CSS to hide the filters (display:none;) but it's not that hard.


For the second part of your comment: this is already built-in functionality. Let's say I use my grid wide filtering to search for a specific name, I will get 2 responses



If I would apply a column filter first, and enter the same text for my grid wide filter, I will only get 1 response



Hi André,


For your specific case I'm not sure if using the grid wide filtering is the best option. 

If you want to use drop downs for filtering, I would advise you to use the column filters instead of grid wide filtering. If you place the corresponding filter in your column header you can make the filters you mention with just using the correct data control.


We use both forms of filtering, but for grid wide filtering you should select the attributes you want to filter on in the properties of the widget and make sure sure you are targeting the string value attributes, so for example your enumeration caption. A user can then type out his filter criteria or use the dropdown filters above your columns



F.e. If you want to use a dropdown filter, you can add this directly in your column header. 


which will eventually look like this:



HI André Baptista,

Here are some tips how you can achieve this,

To create filters for a Mendix Data Grid 2 widget, follow these steps:

  1. Add Data Grid 2 Widget:

    • First, add a Data Grid 2 widget to your page.
    • Configure the data source for the grid (e.g., an entity or a microflow).
  2. Configure Columns:

    • In the Data Grid 2 properties, select the columns you want to filter by (e.g., name, role, type, and status).
    • You can choose which columns to filter over in the properties of the data grid.
  3. Add Filter Widgets:

    • Inside the Filters Placeholder, add the following filter widgets:
      • Text Filter: For the “name” column (text filter).
      • Dropdown Filter: For the “role,” “type,” and “status” columns (dropdown filters).
  4. Set Up Filters:

    • Configure each filter widget to filter the corresponding column.
    • For the dropdown filters, you can either hardcode the options or use an entity as the source for dynamic options.

Remember to adjust the filter settings based on your specific requirements.

For more details, you can refer to the Mendix Documentation on Data Grid 2.1 Additionally, if you need to filter based on user roles, you can set up access rules with XPath constraints to control which data is displayed based on the user’s role 2Unfortunately, Data Grid 2 does not natively support filtering by associations via dropdowns; you may need to use hardcoded dropdowns or create a filtering entity.... Happy Mendix development!