Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Code Block
languagejs
titleExample success type message from CLAPI (notification non-modal):
akioma.swat.Message.message({
   title: "Success",
   type: "success",
   text: "DatensatzInformation erfolgreichwas gespeichertsaved",
   expire: 5000
});
Code Block
languagejs
titleExample modal default OK button
akioma.swat.Message.message({ type: "success", text:"Information was saved", modal: true});

...

Code Block
languagejs
titleShorthand for modal messagesExample Smart Message from Backend
akioma.swat.message({Message.displayMessageNum("MSGGROUP", 56, {
    type: 'info', text: 'Some modal text content here' });
Code Block
languagejs
titleShorthand for Non-Modal (Notification) messages
akioma.notification({ type: 'info', text: 'Some modal text content here'confirm', // the type is coming also from the back-end, but it can be overwritten
    closeOnEsc: false, // default is set to TRUE
    closeOnClickOutside: false, // default is set to FALSE
	modal: true // if not specified, it will use the defaults for the message type
})
??
// get message type from the backend
akioma.swat.Message.getMessageType("MSGGROUP", 56).then(msgType=> {
      console.log(msgType);
});
??
akioma.swat.Message.getMessageNum("MSGGROUP", 56).then(result => {
      akioma.swat.Message.message({
        type  : "warning",
	    showMessageCode: false, // default is TRUE, if to display or not the message code after the text of the message
        text  : result.MessageText,
        modal : true
      });
});
// non-modal, notifications akioma.notification({
Code Block
languagejs
titleOther samples
Example with custom buttons and callback support:
akioma.swat.Message.message({ 
    type: "success", 
    text:"success message!" });

akioma.notification({ type: "error", text:"success message!" });

akioma.notification({ type: "info", text:"success message!" });

akioma.notification({ type: "warn", text:"success message!" });

// modal messages different types

akioma.message({ type: "success", text:"You did it!" });

akioma.message({ type: "info", text:"You did it!" });

akioma.message({ type: "warning", text:"You did it!" });

akioma.message({ type: "error", text:"You did it!" });

akioma.message({ type: "question", text:"You did it!" });One of 10 excel files was uploaded successfully.", 
    modal: true, 
    buttons: ["Continue", "Stop"],
    callback: (val) => { 
        console.log(val); 
    }
});
/* 
in the above example, if you click on the Continue button, it will return NULL,
if you click on the Stop button, it will return True
!!! We recommend to use the example from below, to define the full behaviour of the buttons and the values returned by each button on click !!!
*/??

akioma.swat.Message.message({ 
      type: "success", 
      text:"Are you sure?",
      modal: true, 
      buttons: {
        replyyes: {
               text: "Yes",
               value: "yes was pressed",
               visible: true,
               className: "", // for custom styling
               closeModal: true,
        },
        replyno: {
              text: "No",
              value: "no was pressed",
              visible: true,
              className: "", // for custom styling
              closeModal: true
        }
    
}, callback: function(val){ 
      console.log(val); 
}});
??
akioma.swat.Message.message({
	type : "info",
	closeOnEsc: false, // default is set to TRUE
	closeOnClickOutside: false, // default is set to FALSE
	text : 'Some random text here',
	modal : true
});
Code Block
languagejs
titleExample with buttons as object and more text:
akioma.swat.Message.message({
    title: "Success",
    type: "Success",
    text: "Everything went good!",
    modal: true,
    buttons: {
        ok: {
            text: 'Ok',
            value: 'ok was pressed'
        },
        cancel: {
            text: 'cancel',
            value: 'cancel was presses'
        }
    },
    moretext: 'More informations here'
});

 

If the buttons attribute is an array, we can specify max 2 buttons. When more than 2 buttons are added, the array will became an object to avoid errors.

Code Block
languagejs
titleExample with custom buttons as array and callback supportmore text:
akioma.swat.Message.message({
     typetitle: "successWarning",
    type: text:"warning"One,
of 10 excel files wastext: uploaded"Be successfuly.carefull", 
    modal: true,
     buttons: ["Continue", "StopCancel"],
    callback: (val) => { 
        console.log(val); 
    }moretext: 'More informations here'
});
Code Block
languagejs
titleExample with moretext
akioma.swat.Message.message({
    title: "Error",
    type: "error",
    text: "Something went wrong!",
    modal: true,
    moretext: 'More informations here'
});