Note that there are some explanatory texts on larger screens.

plurals
  1. POExtJS 4: Properly set waitMsgTarget using MVC pattern
    text
    copied!<p>I have extjs 4.0 controller:</p> <pre class="lang-js prettyprint-override"><code>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!') } } }); </code></pre> <p>and extjs view:</p> <pre class="lang-js prettyprint-override"><code>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); } }); </code></pre> <p>As you can see I tried to set waitMsgTarget and waitMsg in both places but it is not appearing when I click Send button.</p> <p>What is wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload