社区
JavaScript
帖子详情
请问如何让XTREE支持CHECKBOX
icebluenet
2005-09-19 11:07:03
请问如何让XTREE支持CHECKBOX,同时能选中上层目录时候下层节点的checkbox默认选中。
...全文
289
6
打赏
收藏
请问如何让XTREE支持CHECKBOX
请问如何让XTREE支持CHECKBOX,同时能选中上层目录时候下层节点的checkbox默认选中。
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
icebluenet
2005-09-24
打赏
举报
回复
谢谢。
nonegigi
2005-09-22
打赏
举报
回复
并且在tree.js调用时把WebFXTreeItem 改成 WebFXCheckBoxTreeItem 其他的具体的你可以看下注视
xtree的作者 非常仔细地注释
nonegigi
2005-09-22
打赏
举报
回复
在xtree.js的最后添加
function WebFXCheckBoxTreeItem(sText, sAction, bChecked, eParent, sIcon, sOpenIcon) {
this.base = WebFXTreeItem;
this.base(sText, sAction, eParent, sIcon, sOpenIcon);
this._checked = bChecked;
}
WebFXCheckBoxTreeItem.prototype = new WebFXTreeItem;
WebFXCheckBoxTreeItem.prototype.toString = function (nItem, nItemCount) {
var foo = this.parentNode;
var indent = '';
if (nItem + 1 == nItemCount) { this.parentNode._last = true; }
var i = 0;
while (foo.parentNode) {
foo = foo.parentNode;
indent = "<img id=\"" + this.id + "-indent-" + i + "\" src=\"" + ((foo._last)?webFXTreeConfig.blankIcon:webFXTreeConfig.iIcon) + "\">" + indent;
i++;
}
this._level = i;
if (this.childNodes.length) { this.folder = 1; }
else { this.open = false; }
if ((this.folder) || (webFXTreeHandler.behavior != 'classic')) {
if (!this.icon) { this.icon = webFXTreeConfig.folderIcon; }
if (!this.openIcon) { this.openIcon = webFXTreeConfig.openFolderIcon; }
}
else if (!this.icon) { this.icon = webFXTreeConfig.fileIcon; }
var label = this.text.replace(/</g, '<').replace(/>/g, '>');
var str = "<div id=\"" + this.id + "\" ondblclick=\"webFXTreeHandler.toggle(this);\" class=\"webfx-tree-item\" onkeydown=\"return webFXTreeHandler.keydown(this, event)\">";
str += indent;
str += "<img id=\"" + this.id + "-plus\" src=\"" + ((this.folder)?((this.open)?((this.parentNode._last)?webFXTreeConfig.lMinusIcon:webFXTreeConfig.tMinusIcon):((this.parentNode._last)?webFXTreeConfig.lPlusIcon:webFXTreeConfig.tPlusIcon)):((this.parentNode._last)?webFXTreeConfig.lIcon:webFXTreeConfig.tIcon)) + "\" onclick=\"webFXTreeHandler.toggle(this);\">"
// insert check box
str += "<input type=\"checkbox\"" +
" class=\"tree-check-box\"" +
(this._checked ? " checked=\"checked\"" : "") +
" onclick=\"webFXTreeHandler.all[this.parentNode.id].setChecked(this.checked)\"" +
" />";
// end insert checkbox
str += "<img id=\"" + this.id + "-icon\" class=\"webfx-tree-icon\" src=\"" + ((webFXTreeHandler.behavior == 'classic' && this.open)?this.openIcon:this.icon) + "\" onclick=\"webFXTreeHandler.select(this);\"><a href=\"" + this.action + "\" id=\"" + this.id + "-anchor\" onfocus=\"webFXTreeHandler.focus(this);\" onblur=\"webFXTreeHandler.blur(this);\">" + label + "</a></div>";
str += "<div id=\"" + this.id + "-cont\" class=\"webfx-tree-container\" style=\"display: " + ((this.open)?'block':'none') + ";\">";
for (var i = 0; i < this.childNodes.length; i++) {
str += this.childNodes[i].toString(i,this.childNodes.length);
}
str += "</div>";
this.plusIcon = ((this.parentNode._last)?webFXTreeConfig.lPlusIcon:webFXTreeConfig.tPlusIcon);
this.minusIcon = ((this.parentNode._last)?webFXTreeConfig.lMinusIcon:webFXTreeConfig.tMinusIcon);
return str;
}
WebFXCheckBoxTreeItem.prototype.getChecked = function () {
var divEl = document.getElementById(this.id);
var inputEl = divEl.getElementsByTagName("INPUT")[0];
return this._checked = inputEl.checked;
};
WebFXCheckBoxTreeItem.prototype.setChecked = function (bChecked) {
if (bChecked != this.getChecked()) {
var divEl = document.getElementById(this.id);
var inputEl = divEl.getElementsByTagName("INPUT")[0];
this._checked = inputEl.checked = bChecked;
if (typeof this.onchange == "function")
this.onchange();
}
};
icebluenet
2005-09-19
打赏
举报
回复
给个思路也行,能不能不去修改他的源代码。
LCKKING
2005-09-19
打赏
举报
回复
帮你顶下吧,这个问题不是2句话就能说清楚的
icebluenet
2005-09-19
打赏
举报
回复
有没有人能给我发一份阿赖的树型控件
icebluenet@eyou.com
x
tree
+
checkbox
+radio,xload
tree
+
checkbox
+radio
`x
tree
`的一个显著特点就是
支持
复选框功能,用户可以通过勾选或取消复选框来选择一个或多个节点,这对于多选操作非常有用。 另一方面,`xload
tree
`是在`x
tree
`基础上进行了扩展,增加了异步加载(ajax加载)的能力...
js树形x
tree
117
8. **多语言
支持
**:js
tree
支持
多语言,通过`language`配置项可以设置语言,或者自定义语言包。 9. **主题与样式**:js
tree
允许自定义主题和样式,以适应不同项目的视觉需求。 10. **无障碍性(Accessibility)*...
xload
tree
3. **xload
tree
+
checkbox
+radio**:这个组合意味着xload
tree
组件不仅
支持
Ajax动态加载数据,还同时
支持
复选和单选功能。用户可以根据需求,通过点击节点旁边的
checkbox
进行多选操作,或通过radio进行单选操作,这在...
ex
tree
2.8
EX
Tree
2.8 是一个专门用于Web开发的高级组件,它提供了一种直观且功能丰富的树形控件,能够
支持
CheckBox
和RadioButton等交互元素。这个控件在网页设计中非常实用,允许用户以树状结构展示数据,并通过
CheckBox
和...
layui+z
tree
下拉树,
支持
单选和多选
同时,为了提高用户体验,可以添加搜索功能,让用户能够快速定位到目标节点。 这个下拉树组件适用于多种场景,比如在权限管理中选择角色、在组织结构中选择员工、在商品分类中选择类型等。通过自定义`z
tree
`的配置...
JavaScript
87,997
社区成员
224,709
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章