Pass the Data Grid selection

How I can pass the data grid selected item as a parameter plus the page parameter to microflow  called via button in the bottom of the page, I need to put the button at the button not on the top of the data grid ???
3 answers

Create a listening Dataview and put the buttons into that dataview.


Hi Alaa,

You can do this by using the htmlsnippet widget from the appstore. Then add a button to your gird and add a class to it something like "MoveThisButtonDown". Then Set the html snippet Content type to "Javascript" and add the following code:

dojo.query(".mx-grid-toolbar").query(".moveThisButtonDown").forEach(function(nodeFrom, index, arr) {

	dojo.query(".mx-dataview-controls").query(".btn").forEach(function(nodeTo, index, arr) {
			if (index === 0) {
				//places the button at the first position,nodeTo,"before");



If you prefer Mendix:
Create an action button in the datagrid's control bar.
Make it to open a microflow which receive two parameters: your Dataview's object and Datagrid's object.
Make the button invissible by add css like "visibility:hidden"
Give it some className so you can call it.
Add a HTML snippet to the page and inside write a javascript that catch your custom button click and then programatically click on the hidden button.
Every time your button is click, it will perform a click to your invisible button and it will launch the microflow which do your logic.

And if you are a fan of Javascript than:

Create an entity which has all needed attributes of the two objects. This will be a temp entity only to help you pass

the attributes of the two objects as mendix did not allow you to pass two different type of objects from Javascript to a microflow. Name it "Test". It can be persistable.

1.Add a HTML snippet to the page and write javascript that on click of your button:

1.1.Get the object from the Dataview.

1.2.Get the object from the Datagrid.

1.3.Create an enetity using ""  of type "Test" and set it's attributes from your two objects.

1.4. In the callback call a microflow with this object "Test".

1.5 In the microflow create your two objects base on "Test" attributes.

That's it. Both ways works when your custom button is clicked .