SweetAlert2 - Toast and Notification

Content Type: Module
Categories: Communication

Overview

This module contains JavaScript actions and nanoflows to show client-side alerts without needing context! Show success messages, validation errors, and more with this fancy toast and notification library. The code is 100% accessible and can be modified to your needs. This module will give you the ability to provide a smoother UI/UX set of toasts and notifications.

Documentation

Demo urlhttps://sweetalert2102-sandbox.mxapps.io/index.html

SweetAlert2 Module for Mendix

Getting Started

NOTE: The basic modal and toast will not require any additional setup. The modals for user input, countdown/timer, and chaining will require alterations to fit your needs.

 

How to Use

  • Download the module and give all users the User role.
  • Give your click event(s) the 'Call a Nanoflow' action, placing the desired JS action or prebuilt sub-nanoflows where you want the modal or toast to fire.
  • If using only the nanoflow, create your decision paths and configure the parameters for the sub-nanoflow.
  • If calling microflow from nanoflow, return a status or value that would allow your nanoflow to fire the alerts based on the return of your microflow.
  • Feed in your parameters based on your decision path.

Features

  • Does not require context
  • Allows custom HTML message content.
  • Relies on nanoflows which will help reduce server-side processing normally done with only microflows.
  • Animate.css integration.
  • Parts of modals can be given custom classes.

Limitations

  • Is not currently plug-and-play, will require the steps below.
  • Real-time alerts are not possible without extra code or use of something like the microflow timer widget.
  • Not all Animate.css animation seem to work as well as others when used on toast notifications.

Additional Required Configuration

  • Locate the ‘vendor’ folder in the following directory: C:\PATH\TO\MENDIX\PROJECT\javascriptsource\sweetalert2
  • Copy the ‘vendor’ folder into the projects main theme folder, where index.html can be found
  • Reference the contents of the ‘vendor’ folder into the head element of the index.html file in your theme folder.
  • If you do not have an index.html file in your theme folder, you should be able to find one in the deployment/web folder after running your project at least once.
  • Use this code:

  • Re-run the application

 

Releases

Version: 2.2.0
Framework Version: 10.0.0
Release Notes:
  • Updated SweetAlert2 library version
  • Fixed nanoflow action exposure display issues
  • Fixed issue with onOpen no longer being a function
  • Added 'heightAuto: false' to all modals to fix issue in later versions of Mendix where a modal would make the page appear blank behind them

 

Version: 2.1.0
Framework Version: 10.0.0
Release Notes: - Added new JS action for a linked button.
Version: 2.0.0
Framework Version: 10.0.0
Release Notes: - Updated to SweetAlert2 v11.10.5 - Added an example for chained modals. - Updated Animate.css integration. - Some parts of the modal alerts can now be given custom classes. - General file maintenance.
Version: 1.1.2
Framework Version: 9.24.0
Release Notes: - Updated Mendix minimum version to 9.24.0. - Updated library to v11.10.2
Version: 1.1.1
Framework Version: 9.6.17
Release Notes: - File relocation within widget. - Upgraded SweetAlert2 to v11.7.12 - Added example modal for user input. - Added example modal for blocking countdown.
Version: 1.0.1
Framework Version: 8.12.0
Release Notes: - Updated module package to 8.12 to allow importing to 9.x.x
Version: 1.0.0
Framework Version: 8.2.2
Release Notes: Initial Release