jQWidgets Forums
jQuery UI Widgets › Forums › Dialogs and Notifications › Window › twice close callback
Tagged: twice close callback
This topic contains 4 replies, has 2 voices, and was last updated by toskf072 9 years, 6 months ago.
-
Authortwice close callback Posts
-
see that sample code..
——————————————————-
<button id=”Button”>Click me</button>
$(“#Button”).jqxButton({
template: ‘success’,
width: 150,
height: 35
});
$(‘#Button’).click(function(){
confirmUI(‘title’,’isOK?’);
});function confirmUI(title, text){
var $dialog = window.$(‘<div id=”confirm_’ + new Date().getTime().toString() + ‘”></div>’);
$dialog.html(‘<div>’ + title + ‘</div><div></div>’);
var buttonString = ‘<div style=”width:100%;”><input type=”button” id=”confirmCancel” value=”Cancel” style=”float:right;” /><input type=”button” id=”confirmOk” value=”OK” style=”float:right;margin-right: 10px” /></div>’;
$dialog.jqxWindow({
minWidth: 300,
minHeight: 80,
draggable: true,
content: text + buttonString,
resizable: false,
closeButtonAction: ‘close’,
isModal: true
});
$dialog.jqxWindow({
okButton: $(‘#confirmOk’),
cancelButton: $(‘#confirmCancel’)
});
$(‘#confirmOk’).jqxButton({ template: ‘primary’ });
$(‘#confirmCancel’).jqxButton({ template: ‘default’ });
$dialog.on(‘close’, function (e) {
if (e.args.dialogResult.OK) { //ok
alert(‘ok’);
} else { //cancel or close
alert(‘cancel’);
}
});
}
—————————————————–i have a ‘#Button’,
first, click #Button
second, if click ‘OK’ button after open the modal window, ‘close’ callback method called twice…but if click ‘Cancel’ button, ‘close’ callback method called only one….
why??????
is it bug?
Hi toskf072,
With proper initialization of the widget there is no such a behavior.
Here is a demo.Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.comhi ivailo..
i saw a your sample code.. thanks..
but i must make a button tag dynamically..
so i made ‘buttonString’
but because make a okbutton dynamically, okButton property is a null..
so i defined okButton on next line..
…………..Here is demo
can you help me?
Have a nice weekend..Hi toskf072,
Try with appending your dialog to the body –
$('body').append($dialog);
Here is the demo.Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.comThank you for your help…ivailo
-
AuthorPosts
You must be logged in to reply to this topic.