日期:2014-05-16  浏览次数:20361 次

ExtJs从入门到精通(2)

1. Ext.Ajax? (extends Connection)

?

				Ext.Ajax.on("requestcomplete", function(_conn, _response,
								_options) {
							alert(_response.responseXML.xml);
						});
				Ext.Ajax.request({
							url : "http://localhost:8080/extjs/servlet/TestServlet",
							params : {
								name : "aaa",
								sex : "bbb"
							}
						})

?

_response.responseText

?

method: get post

?

参数也可以是xml格式的数据

????Ext.Ajax.request({
???????url : "http://localhost:8080/extjs/servlet/TestServlet",
???????method : "post",???????????????????????????
???????xmlData: "<?xml version=\"1.0\" encoding=\"GB2312\"?><aaa></aaa>"
??????});

?

Json数据格式

????Ext.Ajax.request({
???????// dataType : "json",
???????url : "http://localhost:8080/extjs/servlet/TestServlet",
???????method : "post",
???????jsonData : {name:"name",sex:"sex"}
??????});

?

2. Ext.data.Connection (extends Connection)

?

?

Ext.onReady(function() {
	var _window = new Ext.Window({
		title : "登录",
		frame : true,
		width : 500,
		height : 400,
		// layout : "form",
		plain : true,
		resizable : false,
		bodyStyle : "padding:3px",
		labelWidth : 45,
		minimizable : false,
		maximizable : false,
		closable : true,
		closeAction : "hide",
		buttonAlign : "left",
		items : [{
					baseCls : "x-plain",
					style : "padding:5px",
					layout : "column",
					items : [{
								columnWidth : .5,
								layout : "form",
								labelWidth : 55,
								defaults : {
									width : 160
								},
								baseCls : "x-plain",
								defaultType : "textfield",
								items : [{
											layout : "form",
											hideLabel : false,
											fieldLable : "姓名"
										}]
							}, {
								columnWidth : .5,
								layout : "form",
								labelWidth : 55,
								baseCls : "x-plain",
								items : {
									xtype : "textfield",
									fieldLable : "个人照片",
									width : 170,
									height : 177,
									inputType : "image"
								}
							}]
				}],
		showLock : false,
		listeners : {
			"show" : function(_window) {
				if (_window["showLock"]) {
					_window.findByType("textfiled")[7].getEl().dom.src = "xxx.gif";
					showLock = true;
				}
			}
		}
	});
	_window.show();
});

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?