我刚刚开始用sencha touch 2构建应用程序我试图提交一个我现在做的,我想在提交表单时显示加载蒙版。我怎么能点那个?我尝试了几种方法没有获得成功。在sencha touch form中加载蒙版submit
Ext.define('AddressBook.view.Login', {
extend: 'Ext.form.Panel',
xtype: 'login',
requires: ['Ext.form.*'],
config: {
xtype: 'formpanel',
title: '<img src="resources/images/logo.png" width="180px"/> ',
iconCls: 'user',
layout: 'vbox',
style: 'border:none;',
items: [
{
xtype: 'fieldset',
title: 'Service Seeker Login',
scrolable: true,
items: [{
xtype: 'emailfield',
name: 'useremail',
placeHolder: 'Username or Email',
allowBlank: false
}, {xtype:'spacer', style: 'background-color: #EEE; height:20px; border:none;'}, {
xtype: 'passwordfield',
name: 'password',
placeHolder: 'Password',
allowBlank: false
},{xtype:'spacer', style: 'background-color: #EEE; height:20px; border:none;'},{
xtype: 'checkboxfield',
name : 'Remember',
labelWidth: '80%' ,
label: 'Remember me',
value: 'remember'
}, {
xtype: 'hiddenfield',
name: 'type',
value: 'user'
}]
}, {
xtype: 'button',
text: 'LOGIN',
id: 'LoginButon',
ui: 'confirm',
width: '75px',
handler: function() {
//iniate loading screen for user
var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
var form = this.up('formpanel');
var values = form.getValues();
if (values.useremail && values.password) {
form.submit({
url: 'http://mysite/mobilelogin',
method: 'POST',
success: function (form, result) {
if (result.go) {
myMask.show();
localStorage.setItem('userName',values.useremail);
var indexPanel = Ext.create('AddressBook.view.Contacts');
Ext.Viewport.add(indexPanel);
Ext.Viewport.setActiveItem(indexPanel,{type: 'slide', direction: 'right'});
}
},
failure: function (form, result) {
Ext.Msg.alert('', result.message);
}
});
} else {
Ext.Msg.alert('Error', 'Both username and password are required.');
}
}
}
}]
});
我已经发布了这个在sencha网站也。 http://www.sencha.com/forum/showthread.php?190430-Simple-Form-example-with-Ajax-or-Connection-to-backend&p=851571#post851571
非常感谢你..它的工作。 :) – atluriajith 2012-07-11 05:13:29
这不适合我。我在Ajax请求中添加了async:false。完全没有显示掩蔽。如果我从成功/失败块中删除了unmask,则会显示掩码。但是什么时候隐藏面具。 Sencha的执行顺序有问题吗? – nkongara 2013-01-18 15:19:10
控制台中没有错误。当你输入Ext.Viewport.mask({xtype:'loadmask'});在控制台中? – 2013-01-18 15:49:22