Datagrid events to trigger a microflow

1
I'm new to mendix and I want to use Datagrid events to trigger a microflow. I want to : 1- handle changes on grid selection 2- pass grid selected entity to a microflow and execute the microflow I read in this forum that it's possible to use a dataview that listen to grid selection changes and by that way, get the grid selected entity, but I don't know how and where I can add a call to the microflow that way. I also tried to dynamically attach events to datagrid row (By manipulating the dom) but, I didn't find the way to know when the grid is fully populated. If someone know how to do this or can give some advice ...
asked
4 answers
1

Bernard,

A datagrid has some built in event triggers (New, Edit, Delete), and also offers the ability to trigger a microflow by placing a microflow button in the control bar. The microflow button will call a microflow that you specify and can pass in:

  • the selected object in a datagrid
  • all objects currently in the datagrid
  • the parent object of the datagrid (for example, if you had a customer dataview with a nested datagrid showing orders, a microflow button on the orders datagrid could pass in the customer object)

In addition, there are several properties of the microflow button that may help you accomplish what you need to. Look in the properties pane with the microflow button selected.

Hope that helps,

Mike

answered
0

Bernard, This is nothing new, what Mike has mentioned above, but still let me try.

If i understand correctly then you want to have 1) dataview which listens to a datagrid 2) have a microflow trigger/button to send the selected entity. This can be done easily. Please see the reference documentation for more information.

For 2nd part get a microflow trigger in the data view form. While configuring the trigger just add to sent the selected entity.

Please let me know if you need more information. Thanks

answered
0

Bernard, as per your requirements you can add a microflow trigger in the control bar of the datagrid and make it a 'default button' plus you can change the 'visibility' of the same as per your choice. Please go through the documentation and check https://world.mendix.com/display/howto40/Configure+the+default+button+of+a+data+grid

Moreover, you can use the same microflow or the other to pass on the selected entity(parameter) and perform operations over the selected entity or the associated one's based on requisite..

Though i hope this will help you otherwise i would request you to be a little bit more specific about your question because you asked for an execution of a microflow without any button/trigger which is truly a tough nut to crack for me because am also in the middle of learning :)

answered
0

To trigger an microflow when data grid selection changes you need several things:

- A data view with a “Listen to widget” datasource set to that grid – the grid listener.

- A data view inside that view that has a nano/microflow as the datasource having the grid entity as the parameter and returning some data object. When nothing is selected the parameter value is empty

When selection changes the nano/microflow is called. Beware that it’s be called 3 times.

 

To setup the conditional visibility on the data grid buttons based on selection you need extra things:

- A helper entity that will hold the current selection (or a boolean flag). The entity must have an association with the entity we’re working on.

- Enclose the grid and grid listener with two extra data views. The outer data view will create and associate the helper entity with the current object. The inner data view will get the original current object from the helper entity by association. Now we have both objects in context.

- In the grid listener nano/microflow add the helper entity as a parameter and set the attributes of the helper object based on the current selection

- In the grid buttons setup conditional visibility based on the attributes of the helper object.

answered