日期:2014-05-16 浏览次数:20367 次
Ext.get(document.body).update('<div id="test"></div>');
<html> <head> <title>Hello Ext</title> <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css"> <script type="text/javascript" src="extjs/ext-debug.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body></body> </html>
<html> <head> <title>Hello Ext</title> <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css"> <script type="text/javascript" src="extjs/ext.js"></script> <script type="text/javascript" src="app-all.js"></script> </head> <body></body> </html>
sencha create jsb -a index.html -p app.jsb3
sencha create jsb -a http://localhost/helloext/index.html -p app.jsb3
sencha build -p app.jsb3 -d .
handler: function(){ if (!formPanel.getForm().isValid()) return; formPanel.getForm().submit({ waitMsg: '正在提交數據', waitTitle: '提示', method:'POST', url: '', success: function(form, action) { Ext.Msg.alert('提示', '提交成功'); }, failure: function(form, action) { Ext.Msg.alert('提示', '錯誤,原因如下:' + action.result.errors.info); } }); }
onSubmit : Ext.emptyFn, submit : function() { //再次设定action的地址 this.getEl().dom.action ='user.do?method=login'; this.getEl().dom.method = 'post'; //提交submit this.getEl().dom.submit(); };
Ext.Ajax.request({ //请求地址 url: 'login.do', //提交参数组 params: { LoginName:Ext.get('LoginName').dom.value, LoginPassword:Ext.get('LoginPassword').dom.value }, //成功时回调 success: function(response, options) { //获取响应的json字符串 var responseArray = Ext.util.JSON.decode(response.responseText); if(responseArray.success==true){ Ext.Msg.alert('恭喜','您已成功登录!'); } else{ Ext.Msg.alert('失败','登录失败,请重新登录'); } } });
//放在onReady的function(){}中 Ext.QuickTips.init(); //为组件提供提示信息功能,form的主要提示信息就是客户端验证的错误信息。 Ext.form.Field.prototype.msgTarget='side'; //提示的方式,枚举值为
var form1 = new Ext.form.FormPanel({ width:350, renderTo:"form1", title:"FormPanel", defaults:{xtype:"textfield",inputType:"password"}, items:[ {fieldLabel:"不能为空", allowBlank:false, //不允许为空 blankText:"不能为空", //错误提示信息,默认为This field is required! id:"blanktest", } ] });
items:[