Ext.tree.Panel实现单选,多选
Extjs
var productCategoryTreeLookUpFn = function(callback) {
var productCategoryLookUpWindow;
var productCategoryTreeStore;
var productCategoryTreeMenu;
if (!productCategoryLookUpWindow) {
// 加载菜单树
productCategoryTreeStore = Ext.create('Ext.data.TreeStore', {
fields : ['id', 'text'],
proxy: {
type: 'ajax',
url: COMMON.APP_URL + '/view/master/selectProductCategoryForComboBoxTree.action'
},
root: {
id: '0',
text : "产品分类",
expanded: true
}
});
var beforNode = null;
productCategoryTreeMenu = Ext.create('Ext.tree.Panel', {
store: productCategoryTreeStore,
rootVisible : false,
height : 300,
animate : true, // 开启动画效果
enableDD : false, // 不允许子节点拖动
border : false, // 没有边框
singleClickExpand : true,
listeners : {
checkchange : function(node, checked, eOpts) {
// setChildChecked(node, checked);
if(node.isNode){
if(beforNode != null){//把上一次选中节点取消选择,实现单选
beforNode.set("checked",false);
}
beforNode = node;
// node.collapse();
// node.cascadeBy(function(node) {
// node.set("checked",checked);
// });
}
}
}
});
function setChildChecked(node, checked){
node.set({checked:checked});
if(node.hasChildNodes()){
node.eachChild(function(child) {
setChildChecked(child, checked);
});
}
}
function setParentChecked(node, checked){
node.set({checked:checked});
var parentNode = node.parentNode;
if(parentNode != null){
var flag = false;
parentNode.eachChild(function(child) {
if(child.data.checked == true){
flag = true;
}
});
if (checked == false) {
if(!flag){
setParentChecked(parentNode, checked);
}
} else {
if(flag){
setParentChecked(parentNode, checked);
}
}
}
}
productCategoryLookUpWindow = Ext.create('Ext.window.Window', {
title : '产品分类信息',
autoShow: true,
width : 400,
constrain : true,
constrainHeader : true,
maximizable : false,
minimizable : false,
resizable : false,
closable : false,
buttonAlign : 'right',
animateTarget: Ext.getBody(),
modal : true,
plain : true,
border : true,
closeAction : 'destroy',
items : [productCategoryTreeMenu],
buttons : [{
text : '确定',
handler : function() {
var checkNodeArray = productCategoryTreeMenu.getChecked();
var checkNodeString = '';
var checkNodeTextString = '';
for (var index = 0; index < checkNodeArray.length; index++) {
checkNodeString += checkNodeArray[0].data.id;
checkNodeTextString += checkNodeArray[0].data.qtip;
}
if (Ext.isFunction(callback)) {
callback(checkNodeString, checkNodeTextString);
}
productCategoryLookUpWindow.destroy();
}
}, {
text : '关闭',
handler : function() {
productCategoryLookUpWindow.destroy();
}
}]
});
}
productCategoryLookUpWindow.show();
};
Java
for (ProductCategoryVO dbVo : productCategoryVOList) {
JSONObject obj = new JSONObject();
obj.put("id", dbVo.getCategoryIdFull());
obj.put("text", dbVo.getCategoryName());
obj.put("qtip", dbVo.getCategoryNameFull());
obj.put("leaf", !new Boolean(dbVo.getIsExistChildNode()));
obj.put("checked", new Boolean(false));
// obj.put("isExistChildNode", new Boolean(dbVo.getIsExistChildNode()));
// obj.put("categoryId", dbVo.getCategoryId());
// obj.put("categoryName", dbVo.getCategoryName());
// obj.put("categoryIdFull", dbVo.getCategoryIdFull());
// obj.put("categoryNameFull", dbVo.getCategoryNameFull());
// obj.put("parentIdFull", dbVo.getParentIdFull());
// obj.put("parentNameFull", dbVo.getParentNameFull());
// obj.put("recordId", dbVo.getId());
// obj.put("nodeLevel", dbVo.getNodeLevel());
jsonArray.add(obj);
}
Ext.tree.Panel实现单选,多选的更多相关文章
- Ext.tree.Panel Extjs 在表格中添加树结构,并实现节点移动功能
最近在用Extjs 做后台管理系统,真的非常好用.总结的东西分享一下. 先展示一下效果图 好了,开始吧! 首先说一下我的创建结构: 一.构造内容 这个函数中包括store的创建,treePanel的创 ...
- Extjs学习笔记--Ext.tree.Panel
Ext.create('Ext.tree.Panel', { title: 'Simple Tree', width: 200, height: 150, store: store, rootVisi ...
- Extjs4.x Ext.tree.Panel 过滤Filter以及trigger field的使用
Extjs4.x中已经取消了组件Ext.Tree.TreeFilter功能,却掉了树形结构的过滤功能,要实现该功能只能自己写了. Tree节点筛选UI很简单,一个Tbar,一个trigger即可解决问 ...
- Extjs4.x Ext.tree.Panel 遍历当前节点下的所有子节点
Ext.define('WMS.controller.Org', { extend: 'Ext.app.Controller', stores: ['OrgUser', 'OrgTree'], mod ...
- Ext.tree.Panel
initComponent : function() { var data = null; Ext.Ajax.request({ url : 'xxx/xx', ...
- ExtJS 4 在Ext.tab.Panel中使用Ext.ux.IFrame打开url指向的网页
ext-4.2.1.883\examples\ux\IFrame.js ext-4.2.1.883\examples\ux\TabCloseMenu.js 复制到 \Scripts\ext-4.2.1 ...
- Extjs-树 Ext.tree.TreePanel 动态加载数据
先上效果图 1.说明Ext.tree.Panel 控件是树形控件,大家知道树形结构在软件开发过程中的应用是很广泛的,树形控件的数据有本地数据.服务器端返回的数据两种.对于本地数据的加载,在extjs的 ...
- Javascript - ExtJs - Ext.form.Panel组件
FormPanel组件(Ext.form.FormPanel) logogram:Ext.form.Panel | xtype:form Ext.form.Panel.配置 frame }//旗下所有 ...
- Ext.tree.TreePanel 属性详解
Ext.tree.TreePanel 属性详解 2013-06-09 11:02:47| 分类: ExtJs|举报|字号 订阅 原文地址:http://blog.163.com/zzf_fly/b ...
随机推荐
- 关于华为手机Log.d打印不出来log的问题
http://blog.csdn.net/picasso_l/article/details/52489560 拨号,进入后台设置,进行操作.
- ajax 实现输入提示效果
网站主页 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...
- C#连接Sqlite 出现:混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集。的解决方案
C#连接Sqlite 出现: 混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集.的解决方案 C#连接sqlite数据库代码 ...
- Python三方库xlrd,xlwd-Excel读写
恩,我是翻译汪,主要内容来自http://www.python-excel.org/ 在xlrd,xlwt这两个库中,Excel的结构表示为workbook整个Excel对象,sheet工作表,row ...
- python基础--字符串操作、列表、元组、文件操作
一.变量及条件判断 1.字符串.布尔类型.float.int类型,None都是不可变变量 2.字符串是不可变变量,不可变变量就是指定义之后不能修改它的值 3.count +=1和count=count ...
- 16.2 【C# 5】调用者信息特性
16.2.1 基本行为 .NET 4.5引入了三个新特性(attribute),即 CallerFilePathAttribute . CallerLineNumber- Attribute 和 Ca ...
- iOS 中plist文件中配置key值冲突的现象
iOS开发一些特殊的软件需要在项目中配置对应的key值,然而近期在项目中发现一个有意思的现象,苹果官方文档中提供的key值很多,但其实有一些彼此可能有冲突,当你同时配置了彼此冲突的key值,可能会出现 ...
- Luogu P1892 [BOI2003]团伙
P1892 [BOI2003]团伙 题目描述 1920年的芝加哥,出现了一群强盗.如果两个强盗遇上了,那么他们要么是朋友,要么是敌人.而且有一点是肯定的,就是: 我朋友的朋友是我的朋友: 我敌人的敌人 ...
- Silverlight之我见——数据批示(1)
第一次听到这个概念,你是否有点陌生?MSDN上也没有特意的去说明.不要看到这个名词不太熟悉,其实数据批示,玩过C#的人都会非常熟悉,所谓数据批示,其本质就是特性(Attribute),怎么样,现在有点 ...
- ES6-babel转码
关于BaBel转码 有人问我babel的功能以及执行的过程和配置,在网上查阅了大量的资料~收集到这些~有错请指出,及时修改. ------------------------------------- ...