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实现单选,多选的更多相关文章

  1. Ext.tree.Panel Extjs 在表格中添加树结构,并实现节点移动功能

    最近在用Extjs 做后台管理系统,真的非常好用.总结的东西分享一下. 先展示一下效果图 好了,开始吧! 首先说一下我的创建结构: 一.构造内容 这个函数中包括store的创建,treePanel的创 ...

  2. Extjs学习笔记--Ext.tree.Panel

    Ext.create('Ext.tree.Panel', { title: 'Simple Tree', width: 200, height: 150, store: store, rootVisi ...

  3. Extjs4.x Ext.tree.Panel 过滤Filter以及trigger field的使用

    Extjs4.x中已经取消了组件Ext.Tree.TreeFilter功能,却掉了树形结构的过滤功能,要实现该功能只能自己写了. Tree节点筛选UI很简单,一个Tbar,一个trigger即可解决问 ...

  4. Extjs4.x Ext.tree.Panel 遍历当前节点下的所有子节点

    Ext.define('WMS.controller.Org', { extend: 'Ext.app.Controller', stores: ['OrgUser', 'OrgTree'], mod ...

  5. Ext.tree.Panel

    initComponent : function() { var data = null;        Ext.Ajax.request({            url : 'xxx/xx',   ...

  6. 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 ...

  7. Extjs-树 Ext.tree.TreePanel 动态加载数据

    先上效果图 1.说明Ext.tree.Panel 控件是树形控件,大家知道树形结构在软件开发过程中的应用是很广泛的,树形控件的数据有本地数据.服务器端返回的数据两种.对于本地数据的加载,在extjs的 ...

  8. Javascript - ExtJs - Ext.form.Panel组件

    FormPanel组件(Ext.form.FormPanel) logogram:Ext.form.Panel | xtype:form Ext.form.Panel.配置 frame }//旗下所有 ...

  9. Ext.tree.TreePanel 属性详解

    Ext.tree.TreePanel 属性详解 2013-06-09 11:02:47|  分类: ExtJs|举报|字号 订阅  原文地址:http://blog.163.com/zzf_fly/b ...

随机推荐

  1. Skeleton Screen — 骨架屏

    用户体验一直是前端开发需要考虑的重要部分,在数据请求时常见到锁屏的loading动画,而现在越来越多的产品倾向于使用Skeleton Screen Loading(骨架屏)替代,以优化用户体验. Sk ...

  2. 1B课程笔记分享_StudyJams_2017

    课程1B 概述 课程1B主要讲解了Android UI的ViewGroups(视图组).LinearLayout(线性布局).RelativeLayout(相对布局),Portrait Mode(竖屏 ...

  3. MySQL主从备份配置

    MySQL主从热备配置 两台服务器的MySQL版本都是5.5.41master:192.168.3.119slave:192.168.3.120 MySQL主服务器配置:1.创建用于备份的用户 gra ...

  4. css的基本单词

    <border>边框 border边框 <text>文本 text文本 <indent>缩进 indent缩进 <align>对齐方式 align对齐方 ...

  5. 【转】IDEA 中tomcat图片储存和访问虚拟路径

    1.idea 修改Tomcat的虚拟路径(第一种方法)修改配置文件有很多种,但是一直不成功;后来想还是idea的配置原因,这里tomcat虚拟路径只说一种; 修改Tomcat安装路径下server.x ...

  6. B.1 接口

    几乎所有要学习的接口都位于 System.Collections.Generic 命名空间.图B-1展示了.NET4.5以前主要接口间的关系,此外还将非泛型的 IEnumerable 作为根接口包括了 ...

  7. Oracle开发常用函数 max 最大数 自动加 1 的模式

    create sequence bs_com_seq increment by 1 start with 1 minvalue 1 maxvalue 999999 cycle nocache orde ...

  8. Django CBV视图解决csrf认证

    urls.py from django.conf.urls import url from appxx import views urlpatterns = [ url(r"^$" ...

  9. 内存_RAM或ROM_和FLASH存储的真正区别总结

    http://blog.sina.com.cn/s/blog_4b37304d0100fg10.html

  10. vue 底部bottomnav

    <template> <div id="foot"> <div class="tabBar"> <div class= ...