an yang
an yang

Reputation: 29

How to make kendo popup editor AUTO-CLOSE when click outside of the popup window?

I use kendo ui popup editor in this way:

    editable: {
        mode: "popup",
        window: {
            actions: [],
            title: false,
            modal: false,
            resizable: false,
            animation: false,
            clickOutside: true
        }

I don`t know if i can make the popup window auto-close through the editable configuration.

I have tried to add autoHide:true, autoClose: true configurations, but it doesn`t work.

Upvotes: 2

Views: 3241

Answers (2)

Sennix
Sennix

Reputation: 11

I know this is an old question but maybe someone can benefit from this:

$("#btnSave").kendoButton({
    click: function (e) {
        e.preventDefault();
        var dialog = $("#dialog").data("kendoWindow");
        dialog.center();
        dialog.open();
    }
});

$("#dialog").kendoWindow({
    width: 225,
    height: 70,
    modal: true,
    visible: false,
    title: false,
    actions: [],
    open: function() {
        setTimeout(function () {
            $("#dialog").data("kendoWindow").close();
        }, 2000);
    },
    animation: {
        open: { effects: "fade:in"},
        close: { effects: "fade:out"}
    }
});

Upvotes: 1

Mantas Čekanauskas
Mantas Čekanauskas

Reputation: 2228

Just in case any one feel lazy, here is how popup edit window could be closed:

$(document).on('click', function (e) {
    //kendo popup edit window selector
    var windowCont = $('.k-popup-edit-form.k-window-content');

    //if it was first click on kendo grid edit button exit function
    //otherwise popup window will be closed immidiatelly 
    if ($('.k-grid-edit').is(e.target))
        return;

    //if click was outside popup window, trigger close button
    if (!windowCont.is(e.target) && windowCont.has(e.target).length === 0)
        windowCont.find('.k-grid-cancel').click();
})

Upvotes: 0

Related Questions