Using a custom widget to add click events on a standard mendix button

I would like to extend the behavior of the mendix button on the templategrid toolbar. I have created a mendix custom widget and would like to add a click event on the “select all” button. This appears to be impossible. I read that mendix does not allow custom widget to access standard mendix widgets. Is there a walk around?
2 answers

Hi Glarius

This is possible in two ways, add your own button that operates on the selection or get the dijitwidget of your grid with dijit.byNode/dijit.byId, and then override the function attached to the desired function you want to override

You can do all of this in an HTMLSnippet, you dont need to build a widget, here Options was added to the grid in post

Also look into the grid functions (depending on what type of grid)

grd.getCurrentXPath() //for using the xpath serverside to do the full retrieve, requires some java
grd.getSelected() //to get the selection on the screen

getCurrentXPath() is a bit nicer as you can then execute a retrieve based on the widget xpath to perform the operation serverside on the entire resultset. You can also get the type of object displayed in the grid, and using ModelReflection or your own reflection setup in Java, create some sort of setup where you select relevant operations and implement some function that provisions the extra list/buttons to be populated in your grid dynamically


Hi Glarius. Not sure I fully understand what you’re trying to achieve, but can you do it my adding an Action button to the toolbar area and creating a microflow for the button action (call a microflow)?  If the parameter of the microflow you use is a list of objects, it will pass all objects listed in the template grid to the microflow.  You can then perform your additional actions from that microflow as needed.