<ejs-toast id="element">
<e-toast-position X="Right"></e-toast-position>
</ejs-toast>
<ejs-grid id="Grid" allowPaging="true" created="created">
.....
</ejs-grid>
<script type="text/javascript">
function created(args) {
// extending the default UrlAdaptor
class CustomAdaptor extends ej.data.UrlAdaptor {
processResponse(data, ds, query, xhr, request, changes) {
if (!ej.base.isNullOrUndefined(data.message)) {
setTimeout(
() => {
var toastObj = document.getElementById('element').ej2_instances[0];
toastObj.content = data.message;
toastObj.target = document.body;
toastObj.show();
}, 500);
}
.....
}
}
};
</script> |
<ejs-toast id="element">
<e-toast-position X="Right"></e-toast-position>
</ejs-toast>
<ejs-grid id="Grid" actionFailure="actionFailure">
</ejs-grid>
<script type="text/javascript">
function actionFailure(args) {
setTimeout(
() => {
var toastObj = document.getElementById('element').ej2_instances[0];
toastObj.content = args.error[0].error.response.match("Internal Server Error")[0];
toastObj.target = document.body;
toastObj.show();
}, 500);
}
</script> |