var setting = {
view: {
showLine: false,
addDiyDom: addDiyDom//在view中增加这个方法-----这个解决方法
},
data: {
simpleData: {
enable: true
}
},
callback: {
beforeClick:zTreeOnClick
},
async:{
contentType:"application/x-www-form-urlencoded",
enable:true,
type:"post",
url:"/servlet/ContentServer?pagename=spaceFlight/Page/companyCRUD_spaceFlight&crud=sellist"
}
};
//下面定义这个方法:在下面自定义length长度,然后根据长度判断是否加上。。。。。
function addDiyDom(treeId, treeNode) {
var spaceWidth = 5;
var switchObj = $("#" + treeNode.tId + "_switch"),
icoObj = $("#" + treeNode.tId + "_ico");
switchObj.remove();
icoObj.parent().before(switchObj);
var spantxt = $("#" + treeNode.tId + "_span").html();
if (spantxt.length > 10) {
spantxt = spantxt.substring(0, 10) + "...";
$("#" + treeNode.tId + "_span").html(spantxt);
}
}