JQuery Easyui Tree的oncheck事件實(shí)現(xiàn)代碼
用firebug查看其生成html,發(fā)現(xiàn)其checkobx是假的,只是一個(gè)span,來回的變樣式而已,汗
$(".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事件腳本
代碼
$(".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腳本
$(".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è)新版本,或者哪位大牛給改改,我能力太有限了。
- jQuery EasyUI API 中文文檔 - Tree樹使用介紹
- jQuery EasyUI API 中文文檔 - TreeGrid 樹表格使用介紹
- 推薦8款jQuery輕量級(jí)樹形Tree插件
- jquery zTree異步加載簡(jiǎn)單實(shí)例分享
- jquery easyui中treegrid用法的簡(jiǎn)單實(shí)例
- Jquery樹插件zTree用法入門教程
- jquery ztree實(shí)現(xiàn)下拉樹形框使用到了json數(shù)據(jù)
- jQuery EasyUI API 中文文檔 - ComboTree組合樹
- jsTree樹控件(基于jQuery, 超強(qiáng)悍)[推薦]
- jQuery Tree Multiselect使用詳解
相關(guān)文章
jQuery插件animateSlide制作多點(diǎn)滑動(dòng)幻燈片
本文給大家分享的是使用jQuery插件animateSlide制作多點(diǎn)滑動(dòng)幻燈片特效,十分的炫酷,有需要的小伙伴可以參考下2015-06-06Jquery獲取復(fù)選框被選中值的簡(jiǎn)單方法
這篇文章介紹了Jquery獲取復(fù)選框被選中值的簡(jiǎn)單方法,有需要的朋友可以參考一下2013-07-07Jquery組件easyUi實(shí)現(xiàn)手風(fēng)琴(折疊面板)示例
這篇文章主要為大家詳細(xì)介紹了Jquery組件easyUi實(shí)現(xiàn)手風(fēng)琴示例,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-08-08可以浮動(dòng)某個(gè)物體的jquery控件用法實(shí)例
這篇文章主要介紹了可以浮動(dòng)某個(gè)物體的jquery控件,實(shí)例分析了jquery控件實(shí)現(xiàn)頁面浮動(dòng)層的使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-07-07jQuery.get、jQuery.getJSON、jQuery.post無法返回JSON問題的解決方法
在WEB項(xiàng)目中,經(jīng)常會(huì)使用到j(luò)Query進(jìn)行AJAX請(qǐng)求,但是自從使用了.net 3.5以后,以往寫的請(qǐng)求語句就有些小問題了,就是返回的始終是xml,而并不是JSON2011-07-07基于jQuery實(shí)現(xiàn)的圖片切換焦點(diǎn)圖整理
這篇文章主要介紹了基于jQuery實(shí)現(xiàn)的圖片切換焦點(diǎn)圖整理,需要的朋友可以參考下2014-12-12jQuery技巧大放送 學(xué)習(xí)jquery的朋友可以看下
jQuery技巧大放送 學(xué)習(xí)jquery的朋友可以看下,非常不錯(cuò)的整理,推薦。2009-10-10基于Jquery的將DropDownlist的選中值賦給label的實(shí)現(xiàn)代碼
使用Jquery 將DropDownlist的選中值賦給label的代碼,需要的朋友可以參考下。2011-05-05