欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JQuery Easyui Tree的oncheck事件實(shí)現(xiàn)代碼

 更新時(shí)間:2010年05月28日 02:33:54   作者:  
最近項(xiàng)目中有用到Easyui Tree,我想要checkbox的選中事件,但是api只提供了一個(gè)onClick事件,我百度、google之后,額,還是看js吧

 


用firebug查看其生成html,發(fā)現(xiàn)其checkobx是假的,只是一個(gè)span,來回的變樣式而已,汗


復(fù)制代碼 代碼如下:

$(".tree-checkbox", tree).unbind(".tree").bind("click.tree", function() {
if ($(this).hasClass("tree-checkbox0")) {
$(this).removeClass("tree-checkbox0").addClass("tree-checkbox1");
} else {
if ($(this).hasClass("tree-checkbox1")) {
$(this).removeClass("tree-checkbox1").addClass("tree-checkbox0");
} else {
if ($(this).hasClass("tree-checkbox2")) {
$(this).removeClass("tree-checkbox2").addClass("tree-checkbox1");
}
}
}
_2eb($(this).parent());
_2ec($(this).parent());
return false;
});

然后再看其onClick事件腳本
代碼
復(fù)制代碼 代碼如下:

$(".tree-node", tree)
....
bind("click.tree", function() {
$(".tree-node-selected", tree).removeClass("tree-node-selected");
$(this).addClass("tree-node-selected");
if (opts.onClick) {
var _2ea = this;
var data = $.data(this, "tree-node");
opts.onClick.call(this, { id: data.id, text: data.text, attributes: data.attributes, target: _2ea });
}
})

相應(yīng)的修改其check腳本
復(fù)制代碼 代碼如下:

$(".tree-checkbox", tree).unbind(".tree").bind("click.tree", function() {
if ($(this).hasClass("tree-checkbox0")) {
$(this).removeClass("tree-checkbox0").addClass("tree-checkbox1");
} else {
if ($(this).hasClass("tree-checkbox1")) {
$(this).removeClass("tree-checkbox1").addClass("tree-checkbox0");
} else {
if ($(this).hasClass("tree-checkbox2")) {
$(this).removeClass("tree-checkbox2").addClass("tree-checkbox1");
}
}
}
_2eb($(this).parent());
_2ec($(this).parent());
return false;
}).bind("click.tree", function() {//gzl增加
if ($(this).hasClass("tree-checkbox1") && opts.onCheck) {
var _2e9 = this;
var data = $.data(this, "tree-node");
opts.onCheck.call(this, { id: data.id, text: data.text, attributes: data.attributes, target: _2e9 });
}
});

可是怎么也取不到Data值,最后只好$(this).parent().click(),click事件加check是否變?yōu)檫x中判斷,兩個(gè)事件用一個(gè)方法,唉
多希望出個(gè)新版本,或者哪位大牛給改改,我能力太有限了。

相關(guān)文章

最新評(píng)論