를 사용 waitMsgTarget 설정 :의 ExtJS 4 : 제대로 난에 extjs 4.0 컨트롤러가 MVC 패턴
Ext.define('KS.controller.DailyReport', {
extend: 'Ext.app.Controller',
views: ['report.Daily'],
init: function() {
this.control({
'dailyReport button[action=send]': {
click: this.sendDailyReport
}
});
},
sendDailyReport: function(button) {
var win = button.up('window');
form = win.down('form');
form.getForm().waitMsgTarget = form.getEl();
form.getForm().waitMsg = 'Sending...';
if (form.getForm().isValid()) { // make sure the form contains valid data before submitting
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
} else { // display error alert if the data is invalid
Ext.Msg.alert('Invalid Data', 'Correct them!')
}
}
});
ExtJS로보기 : 당신이 볼 수 있듯이
Ext.define('KS.view.report.Daily', {
extend: 'Ext.window.Window',
alias: 'widget.dailyReport',
title: 'Daily report',
layout: 'fit',
autoShow: true,
initComponent: function() {
this.items = [{
waitMsgTarget: true,
xtype: 'form',
url: 'dailyReport.php',
layout: 'fit',
waitMsgTarget: true,
waitMsg: 'Sending...',
items: [{
margin: 10,
xtype: 'datefield',
name: 'reportDate',
fieldLabel: 'Report for:',
format: 'd.m.Y.',
altFormats: 'd.m.Y|d,m,Y|m/d/Y',
value: '12.12.2011',
disabledDays: [0]
}]
}];
this.buttons = [{
text: 'Send',
action: 'send'
},
{
text: 'Cancel',
scope: this,
handler: this.close
}];
this.callParent(arguments);
}
});
내가 두 곳에서 waitMsgTarget 및 waitMsg을 설정하려고 하지만 보내기 버튼을 클릭하면 나타나지 않습니다.
무엇이 잘못 되었나요?
를이 내 초기 문제를 해결하지만, 나는 여전히 전체 뷰포트가 아닌 폼의 부모 창을 차단하는 방법을 이해하지 못하고 있습니까? 폼 정의 외부에서 waitMsgTarget : true를 이동 시켰습니다. 이제 전체 뷰포트를 차단합니다. – Milan
한 가지 더 많은 문제 : 성공/실패시 제출 및 취소 버튼이 사라집니다 ( – Milan
waitMsgTarget : true는 양식을 숨 깁니다. 배치 할 위치를 이동할 필요가 없습니다. 'true'를 참조로 변경해야합니다. 부모 창. form.Basic에 대해 제공된 링크를 살펴보고 유효한 옵션에 대한 설명을 제공합니다. 즉, waitMsgTarget은 부울 값이 아니며 true로 설정하면 편리합니다. – LittleTreeX