---
title: "extjs panel拖动"
author: "justcode316"
date: "2012-11-16T09:56:46Z"
tags: []
categories: ["Web前端"]
slug: "extjs-panel"
draft: false
lastmod: "2012-11-16T09:56:26Z"
id: 1727626
url: "https://justcode316.iteye.com/blog/1727626"
---

```java

Ext.onReady(
	function() {
		new Ext.Panel(
		{
			renderTo:hello,
			width:400,
			height:300,
			title:"我是Panel",
			html:"",
			autoScroll:true,
			collapsible:true,
			tbar:[{text:"顶部按钮1",handler:function(){ ext.messagebox.alert("点击","顶部按钮1被点击")}{text:"顶部按钮2"}],
			bbar:[{text:"底部按钮1"},{text:"底部按钮2"}],
			draggable:{
				insertProxy:false,
				onDrag:function(e){
					var pel = this.proxy.getEl();
					this.x = pel.getLeft(true);
					this.y = pel.getTop(true);
					var s = this.panel.getEl().shadow;
					s.hide();
				},
				endDrag:function(e) {
					this.panel.setPosition(this.x,this.y);
				}
			},
			x:100,
			y:100,
			floating:true
		}
		);
	}
);

```