Home > Web Front-end > HTML Tutorial > jquery ztree checkbox manually select the problem_html/css_WEB-ITnose

jquery ztree checkbox manually select the problem_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:01:07
Original
1263 people have browsed it

The checkbox of ztree must be selected by clicking on the small icon. Now I want to click on the actual content, and the checkbox is selected, as shown in the figure below. Click "Administrator", then the checkbox is selected, and I have also done the triggering event. The code is as follows, But still not selected.
Thank you all in advance


var setting = {        check: {            enable: true        },        data: {            simpleData: {                enable: true            }        },        callback: {            beforeClick: function (treeId, treeNode) {                var zTree = $.fn.zTree.getZTreeObj("treeDemo");                if (treeNode.isParent) {                    //zTree.expandNode(treeNode);                    return false;                } else {                    treeNode.checked = true;                     return true;                }            }        }    };
Copy after login


Reply to the discussion (solution)

It seems not This function is great!

LZ! The research is out. Testing is OK! You try

function zTreeOnClick(event, treeId, treeNode) {	var treeObj = $.fn.zTree.getZTreeObj("treeDemo");    var node = treeObj.getNodeByTId(treeNode.tId);	treeObj.checkNode(node, true, true);}		var setting = {			check: {				enable: true			},						data: {				simpleData: {					enable: true				}			},			callback: {		onClick: zTreeOnClick	}		};
Copy after login
Copy after login
Copy after login

LZ! The research is out. Testing is OK! You try

function zTreeOnClick(event, treeId, treeNode) {	var treeObj = $.fn.zTree.getZTreeObj("treeDemo");    var node = treeObj.getNodeByTId(treeNode.tId);	treeObj.checkNode(node, true, true);}		var setting = {			check: {				enable: true			},						data: {				simpleData: {					enable: true				}			},			callback: {		onClick: zTreeOnClick	}		};
Copy after login
Copy after login
Copy after login


I tried this. First of all, there is no tId attribute in node, and an error "'null' is empty or not an object" will be reported. There is only the id attribute. I will Even if tId is changed to id, this error will still be reported. Is there something wrong with me? ? ?

Tid is automatically generated! In the same way, you can also use the ID as a parameter to find the node! There are several ways to get nodes, you can try

LZ! Researched it. Testing is OK! You try

function zTreeOnClick(event, treeId, treeNode) {	var treeObj = $.fn.zTree.getZTreeObj("treeDemo");    var node = treeObj.getNodeByTId(treeNode.tId);	treeObj.checkNode(node, true, true);}		var setting = {			check: {				enable: true			},						data: {				simpleData: {					enable: true				}			},			callback: {		onClick: zTreeOnClick	}		};
Copy after login
Copy after login
Copy after login


This works
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template