自己写的Ext树,Ext3.4,静态全部加载
var load = function(){
/**
* 书籍资料目录
*/
var bookIT = new Ext.tree.TreeNode({
text:"IT",
leaf:true,
listeners:{
click:function(){
Ext.MessageBox.alert("提示","您点击了"+bookIT.text);
}
}
});
var bookNovel = new Ext.tree.TreeNode({
text:"小说",
leaf:true,
listeners:{
click:function(){
Ext.MessageBox.alert("提示","您点击了"+bookNovel.text);
}
}
});
var bookFinance = new Ext.tree.TreeNode({
text:"金融",
leaf:true,
listeners:{
click:function(){
Ext.MessageBox.alert("提示","您点击了"+bookFinance.text);
}
}
});
var bookRoot = new Ext.tree.TreeNode({
id:"root",
text:"树的根"
});
bookRoot.appendChild(bookIT);
bookRoot.appendChild(bookNovel);
bookRoot.appendChild(bookFinance);
var bookTree = new Ext.tree.TreePanel({
id:'book_tree',
title:'书籍资料',
root:bookRoot,
rootVisible:false,
xtype:'treepanel',
enableDD : true, //允许子节点拖动
bodyStyle:'background-color:#CCCCFF' //设置面板颜色
//titleCollapse:true //True表示为允许单击头部区域任何一个位置都可收缩面板(无效果)
//loader: new Ext.tree.TreeLoader({dataUrl:'treedata.js'}),
//width:200
});
var houseCooking = new Ext.tree.TreeNode({
text:"厨具",
leaf:true,
listeners:{
click:function(){
Ext.MessageBox.alert("提示","您点击了"+houseCooking.text);
}
}
});
/**
* 家居用品目录
*/
var houseTable = new Ext.tree.TreeNode({
text:"桌椅",
leaf:true,
listeners:{
click:function(){
Ext.MessageBox.alert("提示","您点击了"+houseTable.text);
}
}
});
var houseRoot = new Ext.tree.TreeNode({
id:"root",
text:"树的根"
});
houseRoot.appendChild(houseCooking);
houseRoot.appendChild(houseTable);
var houseTree = new Ext.tree.TreePanel({
id:'house_tree',
title:'家居用品',
root:houseRoot,
rootVisible:false,
xtype:'treepanel',
enableDD:true,
bodyStyle:'background-color:#CCCCFF' //设置面板颜色
//width:200,
});
/**
* 电子目录
*/
var electronComputer = new Ext.tree.TreeNode({
text:"电脑",
leaf:true,
listeners:{
click:function(){
Ext.MessageBox.alert("提示","您点击了"+electronComputer.text);
}
}
});
var electronRoot = new Ext.tree.TreeNode({
id:"root",
text:"树的根"
});
electronRoot.appendChild(electronComputer);
var electronTree = new Ext.tree.TreePanel({
id:'electron_tree',
title:'电子',
root:electronRoot,
xtype:'treepanel',
rootVisible:false,
enableDD:true,
bodyStyle:'background-color:#CCCCFF' //设置面板颜色
//width:200
});
/**
* 服装目录
*/
var clothesMan = new Ext.tree.TreeNode({
text:"男装",
leaf:true,
listeners:{
click:function(){
Ext.MessageBox.alert("提示","您点击了"+clothesMan.text);
}
}
});
var clothesGirl = new Ext.tree.TreeNode({
text:"女装",
leaf:true,
listeners:{
click:function(){
Ext.MessageBox.alert("提示","您点击了"+clothesGirl.text);
}
}
});
var clothesRoot = new Ext.tree.TreeNode({
id:"root",
text:"树的根"
});
clothesRoot.appendChild(clothesMan);
clothesRoot.appendChild(clothesGirl);
var clothesTree = new Ext.tree.TreePanel({
id:'clothes_tree',
root:clothesRoot,
rootVisible:false,
xtype:'treepanel',
enableDD:true,
title:'服装',
bodyStyle:'background-color:#CCCCFF' //设置面板颜色
//width:200
});
new Ext.Viewport({
layout: 'border',
items: [{
region: 'north',
//renderTo:'main_top',
//applyTo:'main_top',
contentEl:'main_top',
height:100,
//xtype:'tabpanel',
//title:"首页"
// autoHeight: true,//自动设置高度
border: false,
margins: '0 0 5 0'
}, {
region: 'west',
collapsible: true,//设置前面的展开、收拢效果的加减号
title: '分类',
//xtype: 'treepanel',//不能写这个,否则页面会乱
width: 200,
minSize: 100,
maxSize: 400,//设置左侧面板拉伸的最大宽度与最小宽度
collapsible: true,//允许展开和收缩
autoScroll: true,
split: true,//让用户可以动态地改变区域的大小
items: [bookTree,houseTree,electronTree,clothesTree],
//下面是ext漂亮的折叠功能
layout: 'accordion',
layoutConfig: {
titleCollapse: true, //默认为true,表示单击标题就可以收缩子面板,如果设置为false,则必须单击标题右边的图标来收缩面板。
collapseFirst : false, //当显示title bar时,是否总把收缩、展开按钮放在所有其他按钮的前面。默认值为true。
animate: true, //是否使用动画效果。
hideCollapseTool : false, //当collapsible=true且hideCollapseTool=true时,则隐藏控制收缩、伸展的那个按钮,为false时就显示它,默认值为false。
activeOnTop: false //默认是false,展开和收缩后子面板的位置不变。如果设置为true,就会随着展开和收缩变换位置。展开的面板总是在最顶层
}
}, {
region: 'center',
xtype: 'tabpanel',
contentEl:'main_right',
title:"物品"
}]
});
}//end load
Ext.onReady(load);
自己写的Ext树,Ext3.4,静态全部加载的更多相关文章
- IDEA中Springboot静态文件加载(热部署)
Springboot项目静态文件加载 昨天写项目的时候碰到一个问题,就是静态文件css无法读取到项目中,我仔细思考了下,总结了下,可能有两个问题 1.页面未加载更新 这个可能性非常大,Chrome就是 ...
- 静态属性加载到jvm时候就存放在数据共享区,而不是等new后出现
静态属性加载到jvm时候就存放在数据共享区,而不是等new后出现.他的生命周期是 jvm结束 才会消失,一般的方法属性是对象结束后 就会消失.
- Django项目静态文件加载失败问题
在我们平时的开发过程中,为了方便调试程序,我们都是打开开发者模式,即Debug=True,当我们正式上线的时候肯定就需要把开发者模式关掉,用uwsgi部署上去以后,突然发现我们平时辛苦做的项目的静态文 ...
- Django 04 模板标签(if、for、url、with、autoeacape、模板继承于引用、静态文件加载)
Django 04 模板标签(if.for.url.with.autoeacape.模板继承于引用.静态文件加载) 一.if.for.url.with.autoescape urlpatterns = ...
- 前后端分离 导致的 静态页面 加载 <script type="module" > 报CORS 跨域错误,提示 blocked by CORS policy
1.前言 静态页面 加载 <script type="module" > 报CORS 跨域错误,提示Access to script at ftp:///xxx.js ...
- 关于web项目中静态资源加载不了的一些解决思路
问题的产生: <!--springMVC前端控制器加载--> <servlet> <servlet-name>springmvc</servlet-name& ...
- 面试题--JAVA中静态块、静态变量加载顺序
最后给大家一道面试题练练手,要求写出其结果(笔试) public class StaticTest { public static int k = 0; public static StaticTes ...
- SpringMvc静态资源加载出错
使用mvc:resource配置 web.xml配置是rest风格的/ 服务器启动没问题 访问地址是报404 另外用了default-servlet的方法加载,服务器启动没错,jsp页面加载静态资源要 ...
- (转)面试题--JAVA中静态块、静态变量加载顺序详解
public class Test { //1.第一步,准备加载类 public static void main(String[] args) { new Test(); //4.第四步,new一个 ...
- EXT中的iconCls 图标加载
刚刚遇到了个奇怪的问题. 我用 在主页面用TAB autoLoad:{url:link, nocache: true, scripts:true} 加载页面Student.jsp, 郁闷,FF可以正常 ...
随机推荐
- asp.net微信开发第一篇----开发者接入
在项目的根目录或者特定的文件夹内,创建一个ashx文件(一般处理程序文件),如图 public void ProcessRequest(HttpContext context) { context.R ...
- HDU_2068_RPG错排
Problem Description 今年暑假杭电ACM集训队第一次组成女生队,其中有一队叫RPG,但做为集训队成员之一的野骆驼竟然不知道RPG三个人具体是谁谁.RPG给他机会让他猜猜,第一次猜:R ...
- 几种常用的Java数据源解决方案
http://blog.163.com/qqabc20082006@126/blog/static/22928525201041944847653/
- eclipse中的web-inf下没有web.xml
- Jenkins学习之——(4)Email Extension Plugin插件的配置与使用
1.先安装插件 2.配置 点击高级后 内容配置: 3.项目配置 点击Advanced Settings后 到此所有的配置都设置完成. 附录: 以下内容来自其他网友的博客,内容也没有自己去试,朋友们可以 ...
- Carthage&&cocopads 摘抄笔记
Carthage 是 iOS/Mac 开发生态圈的一个包管理工具,与现在流行的 CocoaPods 不同,它是一个去中心化的解决方案.知道它已经有一段时间了,但是一直没有好好玩过,今天整合 Carth ...
- C#将图片字节流转为Base64直接放入html的img标签src属性中
1,图片要转为byte[], 2,注意加上“data:image/jpeg;base64,”,这里jpeg可以换成其他. string html = "<img src='data:i ...
- php中函数不确定参数个数时获取所有参数
func_get_arg(),func_get_args()和func_num_args()的用法 这三个函数呢,都是以func_打头的,顾名思义,是跟php的函数有关的.我们在写类的时候也经常用到这 ...
- JAVA-2-GetDay
import java.util.*; public class Ch0310 { public static void main(String[] args) { // TODO 自动生成的方法存根 ...
- WindowManager
我们Android平台是一个又一个的Activity组成的,每一个Activity有一个或者多个View构成.所以说,当我们想显示一个界面的时候,我们首先想到的是建立一个Activity,然后所有的操 ...