HTML Table onclick event.

0
Hello,   I want to call a JavaScript on clicking a HTML table. How can this be achieved in Mendix.   Also how to use JQuery in Mendix pages, like $(document).ready()?
asked
2 answers
0

Why using javascript? You are using a low code platform. Use the datagrid with default button. Clicking the datagrid will execute the button logic.

answered
0

$(document).ready() won’t really work in a Mendix app as the event will only be called once. Mendix apps bring in their content via JavaScript calls, so moving between pages won’t give you more ready() events.

If you want to link into the page lifecycle then you need to look at writing your own JavaScript widget to link into the page events. There are tutorials on how to do this in the Mendix Academy, but it’s quite a long process.

You may be able to get away with using an HTMLSnippet or JavaScriptSnippet (both in the Marketplace) to run JS on the page. These are loaded dynamically.

Finally, as Martin suggests, you are probably better to try to use built in Mendix functionality.

Good luck!

answered