Using the following function:
function showError(ptitle,perror){
Ext.Msg.show({
title: ptitle,
icon: Ext.MessageBox.ERROR,
msg: perror,
buttons: Ext.MessageBox.OK
});
}
and I am getting the following error:
Uncaught TypeError: Cannot read property 'ERROR' of undefined
I cannot see wheat is wrong with this code. Any help would be appreciated.
the same code works at my place,
just try Ext.Msg.ERROR instead of Ext.MessageBox.ERROR.
This should work:
Ext.MessageBox.show({
title: ptitle,
icon: Ext.MessageBox.ERROR,
msg: perror,
buttons: Ext.MessageBox.OK
});
Related
I am using Datatable and doing my Remove by rendering returning a link. I wanted to do my Remove by confirm with SweetAlert2 however, it was not able to work as expected.
How do I use sweetalert, I cannot assign an id for returning render a link
I am not sure where you are getting stuck.
Here is my version:
I am using SweetAlert 2:
<script src="https://cdn.jsdelivr.net/npm/sweetalert2#10.15.7/dist/sweetalert2.all.min.js"></script>
I have the following render function in my DataTable:
{
render: function (data) {
return '<a id="del" href="/your/example/here/' + data + '">Remove</a>';
}
}
This is a simplified version of your code, just as a demonstration.
I have the following click handler:
$('#del').on('click', function( event ) {
event.preventDefault(); // don't forget to prevent the default event
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)
}
});
});
This generates a table with links.
When I click on any link, I get the following pop-up alert:
I have not handled anything relating to actually using the link to delete a resource. I leave that up to you, as a follow-on task, after you get the alert working.
You did not really explain what the specific problem is that you are facing, except to say "it's not working".
If you have new, additional, problems after this then you can open a new question - but please try to provide sufficient details, including error messages from your browser's console and an easy-to-recreate problem description with related code.
I need to show the errors in login hook of liferay in popup, but the sentence is only a line of code, so I don't know how implement the popup.
the key line is the next:
<liferay-ui:error exception="<%= NoSuchUserException.class %>" message="This message is editable" />
This error is to showed in a label but I didn't need this.
like this example::
http://www.jose-aguilar.com/blog/wp-content/uploads/2012/07/bootstrap-modal.png
In case you need to show errors in dialog box,I suppose you are using
SessionErrors.add(actionRequest, "error");
to send error from action phase.You can check SeesionErrors for 'error' attribute and display your message in dialog box:
<% if(!SessionErrors.isEmpty(renderRequest))
{
String error=LanguageUtil.get(pageContext, "error");
%>
<aui:script>
YUI().ready(function(A) {
YUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow({
title : 'Error',
dialog: {
bodyContent: '<%=error%>',
destroyOnHide: true,
cache: false,
modal: true,
height: 300,
width: 300
}
})
});
});
</aui:script>
<%} %>
Have look at the Alloy Documentation
http://alloyui.com/examples/tooltip/
As Shivam suggested, you can use a scriplet to get the message.
I've been using `gulp-ruby-sass#1.0.0-alpha' because < 1.0 doesn't play well with Sass >= 3.4
According to the documentation:
gulp-ruby-sass throws errors like a gulp plugin, but streams the erroring files so you can see the errors in your browser.
I use gulp-notify to handle errors with this code that gives me a popup notification that lets me know that something went wrong.
.on('error', notify.onError({
title: 'Error!',
message: '<%= error.message %>',
sound: 'Beep'
}))
This works as-is for my other tasks (in my 'scripts' task I need to specify the gulp-jshint fail reporter). But in my 'styles' task the error message is being streamed to the console and the browser but not to a popup notification.
It's workable as is, but when using browser-sync for css style injection, the error message can be missed. Sometimes I'm not working at the top of the document where it renders the error message.
Ideally, I would like to receive a notification that can prompt me to check for errors. Does anyone know why I can't create a message with gulp-notify?
The solution I found was to wrap notify.onError in an anonymous function and append this.emit('end'):
.on('error', function(err) {
notify.onError({
title: 'Error!',
message: '<%= error.message %>',
sound: 'Beep'
})(err);
this.emit('end');
})
I have a "select" type:
Blah
I have it's values initialized in javascript:
$('a[name="my_name"]').editable({
url: 'blah.php',
name: 'my_name',
source: [
{value: 'Foo', text: 'Foo'},
{value: 'Bar', text: 'Bar'}
]
});
I disable the field on page load with this code: (I have a button that turns on the field whence clicked)
$(document).ready(){
$('a[name="my_name"]').editable('disable');
});
The problem is the "source" values DO NOT get read in when 'enabling' the link.
If I comment out the disable code on page load, the editable field works fine. Only when I first disable, and then enable does this happen. Any clues why?
Im using ExtJS 4, and when try print via js console with console.log, the messages not show. I use Firebug to see the js console.
An example:
...
init: function(){
console.log('Controlador cargado.');
this.control({
'abm-grid-usuarios button[action=show]':{
click: function(btn){
console.log('Se clickeo el boton de vista.');
btn.up('abm-grid-usuarios').verInfoUsuario();
}
}
});
}
I load ext-dev.js, any idea ?.
Do you require your controller in app config?
...
Ext.application({
controllers: [
"ControllerName"
],
...