Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a javascript close action? #3

Closed
onigetoc opened this issue Jan 27, 2019 · 5 comments
Closed

Is there a javascript close action? #3

onigetoc opened this issue Jan 27, 2019 · 5 comments

Comments

@onigetoc
Copy link

Is there a javascript close action?

I want to close the dialog on confirm.
Any javascript callback action to close the dialog?

@rudmanmrrod
Copy link
Owner

Technically there's no clean way to do that, but you can do in confirm callback something like this using jquery

MaterialDialog.dialog(
	"Text here",
	{
		title:"Dialog Title",
		modalType:"modal-fixed-footer",
		buttons:{
			close:{
				className:"red",
				text:"closed",
				callback:function(){
					alert("closed!");
				}
			},
			confirm:{
				className:"blue",
				text:"confirmed",
				modalClose:false,
				callback:function(modal){
					$('.material-dialog').last().modal("close")
				}
			}
		}
	}
);

@onigetoc
Copy link
Author

thank's, i will try.

@onigetoc
Copy link
Author

onigetoc commented Jan 29, 2019

On the latest Materialize version, buton are not in the right order.
It will be interesting tu update. (i can make them float right to inverse them).
I would also add a css to create space between buttons like, margine-left: 4px;
Codepen test: https://codepen.io/onigetoc/pen/ErKeBX

@rudmanmrrod
Copy link
Owner

On the latest Materialize version, buton are not in the right order.
It will be interesting tu update. (i can make them float right to inverse them).
I would also add a css to create space between buttons like, margine-left: 4px;
Codepen test: https://codepen.io/onigetoc/pen/ErKeBX

Perfect, you can do pull request

@rudmanmrrod
Copy link
Owner

@onigetoc and in confirm you can simply remove modalClose property,

	"Text here",
	{
		title:"Dialog Title",
		modalType:"modal-fixed-footer",
		buttons:{
			close:{
				className:"red",
				text:"closed"
			},
			confirm:{
				className:"blue",
				text:"confirmed"
			}
		}
	}
);```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants