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,静态全部加载的更多相关文章

  1. IDEA中Springboot静态文件加载(热部署)

    Springboot项目静态文件加载 昨天写项目的时候碰到一个问题,就是静态文件css无法读取到项目中,我仔细思考了下,总结了下,可能有两个问题 1.页面未加载更新 这个可能性非常大,Chrome就是 ...

  2. 静态属性加载到jvm时候就存放在数据共享区,而不是等new后出现

    静态属性加载到jvm时候就存放在数据共享区,而不是等new后出现.他的生命周期是 jvm结束 才会消失,一般的方法属性是对象结束后 就会消失.

  3. Django项目静态文件加载失败问题

    在我们平时的开发过程中,为了方便调试程序,我们都是打开开发者模式,即Debug=True,当我们正式上线的时候肯定就需要把开发者模式关掉,用uwsgi部署上去以后,突然发现我们平时辛苦做的项目的静态文 ...

  4. Django 04 模板标签(if、for、url、with、autoeacape、模板继承于引用、静态文件加载)

    Django 04 模板标签(if.for.url.with.autoeacape.模板继承于引用.静态文件加载) 一.if.for.url.with.autoescape urlpatterns = ...

  5. 前后端分离 导致的 静态页面 加载 <script type="module" > 报CORS 跨域错误,提示 blocked by CORS policy

    1.前言 静态页面 加载 <script type="module" > 报CORS 跨域错误,提示Access to script at ftp:///xxx.js ...

  6. 关于web项目中静态资源加载不了的一些解决思路

    问题的产生: <!--springMVC前端控制器加载--> <servlet> <servlet-name>springmvc</servlet-name& ...

  7. 面试题--JAVA中静态块、静态变量加载顺序

    最后给大家一道面试题练练手,要求写出其结果(笔试) public class StaticTest { public static int k = 0; public static StaticTes ...

  8. SpringMvc静态资源加载出错

    使用mvc:resource配置 web.xml配置是rest风格的/ 服务器启动没问题 访问地址是报404 另外用了default-servlet的方法加载,服务器启动没错,jsp页面加载静态资源要 ...

  9. (转)面试题--JAVA中静态块、静态变量加载顺序详解

    public class Test { //1.第一步,准备加载类 public static void main(String[] args) { new Test(); //4.第四步,new一个 ...

  10. EXT中的iconCls 图标加载

    刚刚遇到了个奇怪的问题. 我用 在主页面用TAB autoLoad:{url:link, nocache: true, scripts:true} 加载页面Student.jsp, 郁闷,FF可以正常 ...

随机推荐

  1. Spring AOP 实现原理与 CGLIB 应用--转

    AOP(Aspect Orient Programming),作为面向对象编程的一种补充,广泛应用于处理一些具有横切性质的系统级服务,如事务管理.安全检查.缓存.对象池管理等.AOP 实现的关键就在于 ...

  2. Event Delivery: The Responder Chain(事件传递,响应链)

    当我们设计app的时候,我们很可能想动态的响应事件.例如,触摸一个拥有许多不同对象的屏幕,你要决定给哪个对象一个响应事件,怎么样对象接收到事件. 当一个用户产生事件发生时(如 点击),UIKit产生一 ...

  3. Environment Configuration Files

    Environment Configuration Files When a user logs in, an environment is created for that user automat ...

  4. html 第一阶段 学习使用总结

    基本使用内容: <html> <head> <title>Title of the document</title> <link rel=&quo ...

  5. IE7append新的元素自动补充完整路径

    在IE7下,进行append操作时,会把像<img />的src补成完整路径.对于上传到临时目录的图片,提交到后台要进行路径判断的情形要十分注意.

  6. html图像入门

    在HTML中,图像由<img>标签定义. <img>是空标签,意思是说,它只包含属性,并且没有闭合标签. 要在页面上显示图像,需要使用源属性src, src指的是"s ...

  7. JavaScript 类、构造函数、原型

    类.构造函数.原型  :本质均为函数 利用的原理是:词法作用域,调用对象及作用域链  闭包  属性查找方式    设计和new运算符一起使用的函数叫做构造函数. 构造函数的工作:初始化一个新创建的对象 ...

  8. SQL IN BETWEEN操作符

    IN 操作符 IN 操作符允许我们在 WHERE 子句中规定多个值. SQL IN 语法 SELECT column_name(s) FROM table_name WHERE column_name ...

  9. javascript解析从服务器返回的json格式数据

    在javascript中我们可以将服务器返回的json格式数据转换成json格式进行使用,如下: 1.服务器返回的json格式数据: 通过response.responseText获得: " ...

  10. asp.net 字符帮助类 类型转换类

    /// <summary> /// 字符帮助类 /// </summary> public class StringHelper { private static readon ...