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. 递归---NYOJ-90整数划分(一)

    这个题理解了好大会才理解,看了网上的代码,不太理解,但是后来看了好几个人的, 大同小异吧,慢慢的就理解了. 思路: 递归函数的意思是, 将 n 划分为最大数为 m 的划分数, 可以分几种情况 1. 当 ...

  2. 常用html元素的取值和赋值方法总结

    1.获得type类型为TEXT或者AREATEXT的值 var textval = $("#text_id").attr("value"); var textv ...

  3. spring04 spel注入

    1.创建需要的实体类对象 public class Student { //学生实体类 private String name; //姓名 private Integer age; //年龄 priv ...

  4. Myeclipse+Tomcat安装与配置

    一: Myeclipse安装很简单,没什么可说的,下面说一下怎么把英文版的Myeclipse汉化的问题 1.把汉化包解压,将解压后的“language”文件夹,放入Myeclipse\common文件 ...

  5. linux 第三天11讲

    1.linux下的shell 查看目前使用的是哪种shell env [该命令可以显示当前操作系统的环境变量] env | more chsh -s 输入新的shell 如:/bin/csh shel ...

  6. 单例模式 与lock用法

    在之前没用lock之前:如果我实现单例模式:直接就是下面的代码: public class Singleton    {        private static Singleton instanc ...

  7. Xaml 页面布局学习

    对于一开始设计xaml界面的初学者,总是习惯性的拖拽控件进行布局,这样也许方便.简单.快捷,但偶尔会出现一些小错误, 当需要将控件进行很细微的挪动时也比较吃力. 这里,我个人建议用一些代码将xaml界 ...

  8. [转]C++宏定义详解

    一.#define的基本用法     #define是C语言中提供的宏定义命令,其主要目的是为程序员在编程时提供一定的方便,并能在一定程度上提高程序的运行效率,但学生在学习时往往不能 理解该命令的本质 ...

  9. ubuntu11.10(TQ210)下移植boa服务器

    平台:ubuntu11.10 一.下载源码包www.boa.org   boa-0.94.13.tar.gz 二.解压,在其src目录下生产makefile #tar xvfz  boa-0.94.1 ...

  10. mysql命中索引规律

    就算where条件里写了and两个条件,然后建了2个独立索引,1个组合索引,他具体命中哪个是不确定的,他会根据数据分布情况选择. 比如 possible_keys    :f1,f2,f1f2,有三种 ...