Tuesday, May 3, 2016

jQuery Notification in ZK


1- Download jQuery Plugin.

Link- https://github.com/kamranahmedse/jquery-toast-plugin

Javascript code .

$(document).ready(function() {
toastr.options = {
"closeButton" : true,
"debug" : false,
"progressBar" : true,
"preventDuplicates" : true,
"positionClass" : "toast-top-right",
"onclick" : null,
"showDuration" : "400",
"hideDuration" : "1000",
"timeOut" : "1200",
"extendedTimeOut" : "1000",
"showEasing" : "swing",
"hideEasing" : "linear",
"showMethod" : "fadeIn",
"hideMethod" : "fadeOut"
}


});

ZK Viewmodel  code.

public static void showInfoNotification(String title, String message) {
Clients.evalJavaScript("toastr.info('" + message + "', '" + title + "');");
}

public static void showErrorNotification(String title, String message) {
Clients.evalJavaScript("toastr.error('" + message + "', '" + title + "');");
}

public static void showSuccessNotification(String title, String message) {
Clients.evalJavaScript("toastr.success('" + message + "', '" + title + "');");
}

public static void showWarningNotification(String title, String message) {
Clients.evalJavaScript("toastr.warning('" + message + "', '" + title + "');");
}

public static void showInfoNotification(String message) {
Clients.evalJavaScript("toastr.info('" + message + "', '');");
}

public static void showErrorNotification(String message) {
Clients.evalJavaScript("toastr.error('" + message + "', '');");
}

public static void showSuccessNotification(String message) {
Clients.evalJavaScript("toastr.success('" + message + "', '');");
}

public static void showWarningNotification(String message) {
Clients.evalJavaScript("toastr.warning('" + message + "', '');");
}


No comments:

Post a Comment

How ChatGPT can Benefit Coding: Your Guide to Leveraging an AI Language Model

 Introduction: Hello, coders! Welcome to this blog post on how ChatGPT, an AI language model, can benefit your coding skills and projects. A...