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 ...
随机推荐
- HDFS你一定要知道,要考的
你肯定听过Hadoop,对就是那头奔跑的小象. Hadoop作为大数据时代代表性的解决方案被大家所熟知,它主要包含两部分内容: HDFS分布式文件存储 MapReduce分布式计算框架 前面我们分析存 ...
- Python随笔-函数
在Python中,定义一个函数要使用def语句,依次写出函数名.括号.括号中的参数和冒号:,然后,在缩进块中编写函数体,函数的返回值用return语句返回. def GetMax(v1, v2):#注 ...
- maven——项目构建和依赖管理工具
apache maven是一个用于项目构建和依赖管理的工具. 添加archetype https://repo1.maven.org/maven2/archetype-catalog.xml 更改本地 ...
- html5——伸缩比例案例(携程)
1.有图片的盒子,最好是父盒子设置伸缩属性,a标签设置伸缩比例1,img标签宽度100% 2.不要见到父盒子就设置伸缩属性,而是根据子盒子是否占据一行,若是子盒子占据一行,那么只要给子盒子设置伸缩比例 ...
- jQuery——入口函数
中文网 http://www.css88.com/jqapi-1.9/ 版本兼容问题 版本一:1.x版本,兼容IE678 版本二:2.x版本,不兼容IE678 入口函数区别 <script> ...
- [Windows Server 2012] PHPWind安全设置
★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com★[护卫神·V课堂]是护卫神旗下专业提供服务器教学视频的网站,每周更新视频. ★ 本节我们将带领大家:PHPWin ...
- RadioButtonList的兩種實現方式
一種是修改ItemTemplate,即ListBoxItem裏面的内容 <ListBox ItemsSource="{Binding}"> <ListBox.It ...
- MyBatis入门2_增删改查+数据库字段和实体字段不一致情况
本文为博主辛苦总结,希望自己以后返回来看的时候理解更深刻,也希望可以起到帮助初学者的作用. 转载请注明 出自 : luogg的博客园 谢谢配合! 当数据库字段和实体bean中属性不一致时 之前数据库P ...
- Unity中确定时间是否在一定范围内
NowTime = DateTime.Now.ToLocalTime(); Timeyear = DateTime.Now.ToLocalTime().ToString("yyyy-MM-d ...
- modelsim 仿真软件 百度云分享 modelsim se 10.7 10.6d 10.6c 10.5 10.4
modelsim se 10.7 链接:https://pan.baidu.com/s/1NDC2yMCZmA4bIRSk2dUiTg 提取码:4l1d 复制这段内容后打开百度网盘手机App,操作更方 ...