我正在使用Webix模式框。 我需要从包含在此模态框中的表单中接收数据,但在获取数据之前它会消失。 这是代码:
this.modalOpen = function (modal, form) {
webix.message.keyboard = false;
_Reference.$modal = webix.modalbox({
view: "window",
position: "center",
title: modal.title,
text: form,
width: modal.width,
buttons: modal.buttons,
callback: function (result) {
if(result === 0) {
return false;
}
var functionName = modal.actions[result];
if (typeof functionName === "function") {
functionName.apply(null);
}
}
});
};
此功能中包含的数据类似于
this.route = "/detail/";
this.modalSettings = {
create: {
title: "Новая деталь",
width: 500,
buttons: ["ДОБАВИТЬ", "ОТМЕНА"],
actions: [this.store, this.modalClose]
},
show: {
title: ""
},
edit: {}
};
答案 0 :(得分:0)
您可以存储模态框的参考,并在关闭模式框后读取结果,如下一个
var modal = {
title: "Новая деталь",
width: 500,
buttons: ["ДОБАВИТЬ", "ОТМЕНА"],
actions: [this.store, this.modalClose]
};
webix.message.keyboard = false;
var t = webix.modalbox({
view: "window",
position: "center",
title: modal.title,
text: "<input id='m1' type='text'>",
width: modal.width,
buttons: modal.buttons,
callback: function (result) {
if(result === 0) {
return false;
}
var value = t.getElementsByTagName("input")[0].value;
webix.message("value: "+value);
}
});