In init.mustache add dialog window tags
Add to init function of CanJS controller
init: function () {
var self = this;
this.options.count = can.compute(false);
this.element.html(initView({
count: this.options.count
}));
this.options.myDialog = new Dialog($('#myDialog', this.element),
{
show: can.compute(false), modal: true,
autoOpen: false,
width: "500px",
buttons: [
{
text: "OK",
classes: "default-btn",
click: function () {
self.options.myDialog.close();
}
},
{
text: "Cancel",
classes: "dark-blue-btn",
click: function () {
self.options.myDialog.close();
}
}
]
}
);
Put this code in action function
new SentFormModel(requestData).save(function (data) {
var getData = function () {
setTimeout(function () {
new SentFormModel().getSendStatus({id: data.id},
function (data) {
self.options.myDialog.open();
self.options.count(data.count);
console.log(data);
if (!data.isComplete) {
getData();
}
}, function (data) {
console.log(data);
});
}, 2000);
};
getData();
}, function (res) {
var errObj = eval("(" + res.responseText + ")");
new ErrorDialog('', errObj);
self.options.flag(true);
});
No comments:
Post a Comment