you can do this with css.
place the contents in a container and with css give the container a display none
then you can use the :last-child selector and give the container display:block
the downside is that the container will still be rendered in every list item, but It might be a bit more managable than the java script option.
As a start, your JavaScript is (probably) triggered before the content of your listview is loaded. Then create some form of ‘waiting’ function to check that the list-items have loaded
function whileLoading(selector, callback, timeoutTime = 20) {
if (jQuery(selector).length) {
callback();
} else {
setTimeout(function() {
whileLoading(selector, callback);
}, timeoutTime);
}
}
The function above can be triggered with something like
whileLoading('.selector', yourFunction);
After that JS can be used to move the ‘add photos’ tile to the DOM location beneath the listview items.
This might help, though it’s no complete solution.
Hi Sjors,
For future compatibility I would strongly discourage editing the DOM with javascript. This will like cause trouble for the future you/college, when migrating to the next version.
You can make this work with Mendix only. Just be creative…. Have a data source microflow/nanoflow that adds an extra empty image object. Based on Boolean/enum set visibility you can show the + sign in the empty object, and show the real pictures in the others
Cheers, Andries.