how to create row rapidly - Telerik Kendo UI MVC grid pop-up mode

感情迁移 提交于 2020-01-16 15:46:14

问题


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;
    }
};


来源:https://stackoverflow.com/questions/36333173/how-to-create-row-rapidly-telerik-kendo-ui-mvc-grid-pop-up-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!