How to manipulate a Template Grid selection programatically? (Enabled, disabled elements, simple multi-selection)
0
Dear Mendix Community, I am looking to create a calendar template in Mendix where users can select multiple dates for the next 1 month. The selected dates will then be passed to a microflow for processing. I would value your suggestions for the following: Some objects should be disabled (unselectable); Helper buttons should be available outside the template for preselecting certain dates (e.g., every Monday, every other day); Users should be able to modify their selections (add or remove items) before triggering the microflow with a separate button. From my research, manipulating the "selection" property of the mxui.widget.TemplateGrid object allows control over the selected items. However, it appears that manually updating each object's .selected CSS class is necessary to display the correct visual state. And there might be a way to extend this to behave like a disabled element (e.g. delete the item from the selected list after onclick. (Wrapping in a container and setting the class to "disabled" made only visual changes but the elements remained selectable), I am unsure if there is an easier approach to achieve the desired outcome. Additionally, I would appreciate guidance on how to set the number of rows (weeks) displayed based on the number of weeks overlapping the next 28-31 days (4, 5, or 6 weeks). The first column should always represent Mondays.