-->

how to create row rapidly - Telerik Kendo UI MVC g

2019-09-05 00:07发布

问题:

I have a grid similiar that. But I don't want to close pop-up window; after clicking update button, i want to save record and clear all (or some) fields and continue to create (other) new record. So user can re-insert new record rapidly (multiple insert in the same window).

Finally user click the "cancel" (or close) button and popup will be closed. How can I do that.

回答1:

Subscribe to Grid Edit/Save javascript events and follow the example below

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;
    doClearingFieldsIfNeed();        
}
else {
    _IsNewMemberAlerted = false;
    }
};