Extjs3.2+Json lib动态树与GridPanel简单展现
最近项目中要用到Extjs,网上搜了写文档看了之后,写了个小Demo。
Demo描述:
将部门信息用树展示出来,点击树节点的某个部门之后,弹出一个窗口,该窗口中展示这个部门中员工的列表。
?
首先,到http://www.sencha.com/products/js/download.php下载Extjs3.2的发布包,因为要用到json lib,所以还要到http://sourceforge.net/projects/json-lib/files/json-lib/下载json lib。
?
mysql数据库脚本:
?
view plaincopy to clipboardprint?
- DROP?TABLE?IF?EXISTS?`dept`;??
- CREATE?TABLE?`dept`?(??
-
??`deptno`?int(11)?NOT?NULL?AUTO_INCREMENT,??
-
??`deptname`?varchar(255)?NOT?NULL?DEFAULT?'',??
-
??`parentno`?int(11)?NOT?NULL?DEFAULT?'0',??
- ??PRIMARY?KEY?(`deptno`)??
- )?ENGINE=InnoDB?AUTO_INCREMENT=11?DEFAULT?CHARSET=utf8;??
- LOCK?TABLES?`dept`?WRITE;??
-
;??
-
INSERT?INTO?`dept`?VALUES?(1,'管理部',0);??
-
INSERT?INTO?`dept`?VALUES?(2,'销售部',0);??
-
INSERT?INTO?`dept`?VALUES?(3,'人力资源部',0);??
-
INSERT?INTO?`dept`?VALUES?(4,'开发部',0);??
-
INSERT?INTO?`dept`?VALUES?(5,'后勤部',0);??
-
INSERT?INTO?`dept`?VALUES?(6,'软件开发部',4);??
-
INSERT?INTO?`dept`?VALUES?(7,'增值开发部',4);??
-
INSERT?INTO?`dept`?VALUES?(8,'增值销售部',2);??
-
INSERT?INTO?`dept`?VALUES?(9,'产品销售部',2);??
-
INSERT?INTO?`dept`?VALUES?(10,'人妖部',3);??
-
;??
- UNLOCK?TABLES;??
- DROP?TABLE?IF?EXISTS?`emp`;??
- CREATE?TABLE?`emp`?(??
-
??`empno`?int(11)?NOT?NULL?AUTO_INCREMENT,??
-
??`empname`?varchar(255)?NOT?NULL?DEFAULT?'',??
-
??`gender`?int(11)?NOT?NULL?DEFAULT?'0',??
<