jquerytreeview的简单介绍

http://www.itjxue.com  2023-01-17 04:32  来源:未知  点击次数: 

jsp页面用jquery.treeView点击父节点文本弹出子节点怎么弄啊???

你说的+号是: onnodeclick:function(item){.....},你打开那个tree.js文件,看看这个事件是怎么写的,然后你照写一个,比如: onnodetextclick:function(item){}

下边是节点点击的事件,我没时间去看它的代码,暂时就发给你,你增加一个文本点击的事件

$.fn.treeview = function(settings) {

var dfop =

{

method: "POST",

datatype: "json",

/**

* @description {Config} url

* {String} Url for child nodes retrieving.

*/

url: false,

/**

* @description {Config} cbiconpath

* {String} Checkbox image path.

*/

cbiconpath: "./css/images/icons/",

icons: ["checkbox_0.gif", "checkbox_1.gif", "checkbox_2.gif"],

/**

* @description {Config} showcheck

* {Boolean} Whether to show check box or not.

*/

showcheck: false,

/**

* @description {Event} oncheckboxclick:function(tree, item, status)

* Fired when check box is clicked on.

* @param {Object} tree This tree object.

* @param {Object} item Node item clicked on.

* @param {Number} status 1 for checked, 0 for unchecked.

*/

oncheckboxclick: false,

/**

* @description {Event} onnodeclick:function(tree, item)

* Fired when a node is clicked on.

* @param {Object} tree This tree object.

* @param {Object} item Ndde item clicked on.

*/

onnodeclick: false,

/**

* @description {Config} cascadecheck

* {Boolean} Whether node being seleted leads to parent/sub node being selected.

*/

cascadecheck: true,

/**

* @description {Config} data

* {Object} Tree theme. Three themes provided. 'bbit-tree-lines' ,'bbit-tree-no-lines' and 'bbit-tree-arrows'.

* @sample

* data:[{

* id:"node1", //node id

* text:"node 1", //node text for display.

* value:"1", //node value

* showcheck:false, //whether to show checkbox

* checkstate:0, //Checkbox checking state. 0 for unchecked, 1 for partial checked, 2 for checked.

* hasChildren:true, //If hasChildren and complete set to true, and ChildNodes is empty, tree will request server to get sub node.

* isexpand:false, //Expand or collapse.

* complete:false, //See hasChildren.

* ChildNodes:[] // child nodes

* }]

* */

data: null,

/**

* @description {Config} clicktoggle

* {String} Whether to toggle node when node clicked.

*/

clicktoggle: true,

/**

* @description {Config} theme

* {String} Tree theme. Three themes provided. 'bbit-tree-lines' ,'bbit-tree-no-lines' and 'bbit-tree-arrows'.

*/

theme: "bbit-tree-arrows" //bbit-tree-lines ,bbit-tree-no-lines,bbit-tree-arrows

};

function nodeclick(e) {

var path = $(this).attr("tpath");

var et = e.target || e.srcElement;

var item = getItem(path);

if (et.tagName == "IMG") {

//+ if collapsed, expend it

if ($(et).hasClass("bbit-tree-elbow-plus") || $(et).hasClass("bbit-tree-elbow-end-plus")) {

var ul = $(this).next(); //"bbit-tree-node-ct"

if (ul.hasClass("bbit-tree-node-ct")) {

ul.show();

}

else {

var deep = path.split(".").length;

if (item.complete) {

item.ChildNodes != null asnybuild(item.ChildNodes, deep, path, ul, item);

}

else {

$(this).addClass("bbit-tree-node-loading");

asnyloadc(item, true, function(data) {

item.complete = true;

item.ChildNodes = data;

asnybuild(data, deep, path, ul, item);

});

}

}

if ($(et).hasClass("bbit-tree-elbow-plus")) {

$(et).swapClass("bbit-tree-elbow-plus", "bbit-tree-elbow-minus");

}

else {

$(et).swapClass("bbit-tree-elbow-end-plus", "bbit-tree-elbow-end-minus");

}

if(dfop.theme!="bbit-tree-lines-no-folder")

$(this).swapClass("bbit-tree-node-collapsed", "bbit-tree-node-expanded");

}

//if expended, collapse it

else if ($(et).hasClass("bbit-tree-elbow-minus") || $(et).hasClass("bbit-tree-elbow-end-minus")) {

$(this).next().hide();

if ($(et).hasClass("bbit-tree-elbow-minus")) {

$(et).swapClass("bbit-tree-elbow-minus", "bbit-tree-elbow-plus");

}

else {

$(et).swapClass("bbit-tree-elbow-end-minus", "bbit-tree-elbow-end-plus");

}

if(dfop.theme!="bbit-tree-lines-no-folder")

$(this).swapClass("bbit-tree-node-expanded", "bbit-tree-node-collapsed");

}

else if ($(et).hasClass("bbit-tree-node-cb")) // click on checkbox

{

var s = item.checkstate != 1 ? 1 : 0;

var r = true;

if (dfop.oncheckboxclick) {

r = dfop.oncheckboxclick.call(et, item, s);

}

if (r != false) {

if (dfop.cascadecheck) {

cascade(check, item, s);

bubble(check, item, s);

}

else {

check(item, s, 1);

}

}

}

}

else {

if (dfop.citem) {

var nid = dfop.citem.id.replace(/[^\w]/gi, "_");

$("#" + id + "_" + nid).removeClass("bbit-tree-selected");

}

dfop.citem = item;

$(this).addClass("bbit-tree-selected");

if (dfop.onnodeclick) {

if (!item.expand) {

item.expand = function() { expandnode.call(item); };

}

dfop.onnodeclick.call(this, item);

}

}

}

如何使用jquery.treeview.js控件,显示树形菜单

从可见的行列表中提取部分: NSArray *indexPathsForVisibleRows = [tableView indexPathsForVisibleRows];

NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];

for ( NSIndexPath *indexPath in indexPathsForVisibleRows ) {

[indexSet addIndex:indexPath.section];

}

NSLog(@"indexSet %@",indexSet);

// indexSet NSMutableIndexSet: 0x11a5c190[number of indexes: 5 (in 1 ranges

用Jquery或javascript实现点击TreeView的根节点展开或折叠显示不同的根节点图片?

给你个思路:

也许可以给子节点 设置 style属性 style="display:none;"

(toggle在新版本中已经取消了使用,仅有动画效果:消失和展示)

但是你可以判断子节点的属性 .is(":visible") 和 .is(":hidden")来实现这个效果:

click事件:(jQuery)

点击根节点,如果子节点(展示就隐藏,隐藏就展示);但是要注意根节点和子节点应该是有一定关系的,这个你自己想想可以解决的。

jquery中的$treeview是什么意思

jquery中的$treeview是什么意思

$就是jquery对象

$.get 就是调用jquery对象里的get方法

$就是相当于一个jQuery的成员变量。

你可以替换他,

jQuery(function($) {

//这样你使用$就不会有冲突啦、

}

jquery.treeview和ztree哪个好用

个人觉得Ztree比较好用一些

首先treeView是无序灵活的可折叠的树形菜单,只试用于一些菜单的导航。

Ztree就比较强大了;

灵活的编辑(增/删/改/查)功能,可随意拖拽节点,还可以多节点拖拽哟

简单的参数配置实现 灵活多变的功能

在一个页面内可同时生成多个 Tree 实例

兼容 IE、FireFox、Chrome、Opera、Safari 等浏览器

支持 JSON 数据

采用了 延迟加载 技术,上万节点轻松加载,即使在 IE6 下也能基本做到秒杀

支持任意更换皮肤 / 自定义图标(依靠css)

提供多种事件响应回调

支持极其灵活的 checkbox 或 radio 选择功能

所以建议使用过程中,选择ztree比较好

(责任编辑:IT教学网)

更多

推荐图片影音文章