How to manipulate the Xpath constraints of a datagrid in a MF?

0
Hi guys,   I am showing a datagrid with some xpath constraints without the arcived objects. Now i want to include PRECISELY one button (no searhbutons, searchfields or so) with a mf to manipulate the xpathconstraints of the datagrid so I can included the archived status in xpath and reload the datagrid. This seems me the best for the user. Asked a similar question in the past but did not receive a satisfying answer. Anyone an idea which covers the requirements?
asked
3 answers
4

Mike's suggestion with using tabs is a good practice, and also something I use often. Keep in mind that mendix is smart enough to not load data for non-active tabs. This means that the application load much faster.

However, another option that you might be interested in, is to use a helper object to select and then filter based on an enum attribute. 


Lets say you have your entity "Employee" and you want to filter based on an enum attribute "status" of type 'ENU_EmployeeStatus'. You need to create a helper (non-persistable) Entity e.g. EmployeeStatusHelper with the enum attribute "selected_status" of type 'ENU_EmployeeStatus'.

Then show this entity in a data view (instantiate a new object in a microflow) and add a dropdown to select the status.

Then you have two options:

1) use a onChangeMicroflow for the dropdown select to filter your results

2) wrap your results in divs with conditional visibility based on the selected_status attribute - this actually allows you to have different viewsbased on the status, perhaps a background color etc

I hope this helps,

Andrej

answered
2

Enzo,

When I have had this kind of requirement for my apps, I find a tabbed interface works well.  In your case, you could have a page with a tab container.  The tab container could have 2 tabs, the first tab would be entitled 'Active' or some other title that fits your requirements.  This tab would have the datagrid that does not display archived items.  The second tab could be entitled 'All' and would have a datagrid that matches the first tab in appearance, but the XPath of this datagrid includes archived items.  With this page, the users could toggle between viewing active items and all items by use of just one button - the tab title.

Hope that helps,

Mike

P.S. if you put class tab-pills on the tab contrainer, the tabs look like 2 buttons.

answered
1

Did you have a look at the Predefined filters widget? Seems to offer what you're looking for.

answered