jQWidgets Forums

jQuery UI Widgets Forums Dialogs and Notifications Window twice close callback

This topic contains 4 replies, has 2 voices, and was last updated by  toskf072 9 years, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • twice close callback #78320

    toskf072
    Participant

    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?

    twice close callback #78335

    ivailo
    Participant

    Hi toskf072,

    With proper initialization of the widget there is no such a behavior.
    Here is a demo.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    twice close callback #78371

    toskf072
    Participant

    hi 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..

    twice close callback #78375

    ivailo
    Participant

    Hi toskf072,

    Try with appending your dialog to the body – $('body').append($dialog);
    Here is the demo.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    twice close callback #78472

    toskf072
    Participant

    Thank you for your help…ivailo

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.