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

select:unselecting option and active dialog box #4862

Closed
tagx opened this issue Apr 8, 2017 · 2 comments
Closed

select:unselecting option and active dialog box #4862

tagx opened this issue Apr 8, 2017 · 2 comments

Comments

@tagx
Copy link

tagx commented Apr 8, 2017

on my program when I hit the "x" icon to clear data a dialog will appear asking the user if she/he wants to clear the data. how do i prevent the clearing of data when the dialog is active incase the user wants to cancel.

here's my code:

$('#mae_mic').on('select2:unselecting', function(e) {
				var sel = $("#mae_mic option:selected").val(); //getting the value of an option 

				BootstrapDialog.show({
				title: 'Removing Mechanic in-charge Record',
				type: 'type-primary',
				message: 'Do you want to remove this in-charge?',
				buttons: [{
					label: '  Yes',
					icon: 'glyphicon glyphicon-ok',
					cssClass: 'btn-primary',
					action: function(dialog) { 
								dialog.close(); 
								return true;
							}
					}, 
				{
					label: '  No',
					icon: 'glyphicon glyphicon-remove',
					cssClass: 'btn-danger',
					action: function(dialog) {
							e.preventDefault();
							dialog.close(); 
					}
				}]
			});	
			});

thanks in advance guys. hope I can find answer here!

@alexweissman
Copy link
Contributor

In the future, please try to format your code properly, with proper indentation so that we can read it.

It sounds like #5058 and the clearing event would work for this situation.

@tagx
Copy link
Author

tagx commented Oct 2, 2017

$('#mae_mic').on('select2:unselecting', function(e) {
var sel = $("#mae_mic option:selected").val(); //getting the value of an option 
	BootstrapDialog.show({
		title: 'Removing Mechanic in-charge Record',
		type: 'type-primary',
		message: 'Do you want to remove this in-charge?',
		buttons: [{
			label: '  Yes',
			icon: 'glyphicon glyphicon-ok',
			cssClass: 'btn-primary',
			action: function(dialog) { 
						dialog.close(); 
						return true;
					}
			}, 
		{
			label: '  No',
			icon: 'glyphicon glyphicon-remove',
			cssClass: 'btn-danger',
			action: function(dialog) {
					e.preventDefault();
					dialog.close(); 
			}
		}]
	});
});

Actually I manage to answer my own question. I figure this out but not with the bootstrap dialog but the native dialog javascript. but if you can integrate with this is more helpful to us. thanks

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

No branches or pull requests

4 participants