This is a migrated thread and some comments may be shown as answers.

Pop Up Editing - Save but don't close window

1 Answer 355 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Derek Kepler
Top achievements
Rank 1
Derek Kepler asked on 17 Jun 2013, 09:36 PM
When creating a new item (using popup editing) I would like to save the data but prevent the popup from closing.  Instead I would like to show additional options that aren't shown until the initial object is created.  Can anyone tell me how to accomplish this?  I tried adding a "Close" event to the window but that never fires for some reason.


Thanks,
Derek

1 Answer, 1 is accepted

Sort by
0
Accepted
Derek Kepler
Top achievements
Rank 1
answered on 18 Jun 2013, 08:15 PM
I figured this out.  For anyone else out there, here is how you can do it.  Subscribe to Grid Edit/Save javascript events and follow the example below.  Hopefully it will help someone.

var _PreventWindowClose = false;
var _IsNewMemberAlerted = false;
 
 
function onGridEdit(e) {
    var window = this.editable.element.data("kendoWindow");
    window.bind("close", onWindowEditMemberClose);
}
 
function onGridSave(e) {
    if (e.model.isNew() && !_IsNewMemberAlerted) {
        _IsNewMemberAlerted = true;
        _PreventWindowClose = true;
    }
}
 
var onWindowEditMemberClose = function (e) {
    if (_PreventWindowClose) {
        e.preventDefault();
        _PreventWindowClose = false;
        toggleMemberTabs();
        alert("New Member successfully created. You may now update member Supervisors.");
    }
    else {
        _IsNewMemberAlerted = false;
    }
};
Tags
Grid
Asked by
Derek Kepler
Top achievements
Rank 1
Answers by
Derek Kepler
Top achievements
Rank 1
Share this question
or