...
setData(objectname, data),设定属性控件的所有节点的信息,是一个数组,包含父子关系。
- 示例:pktree.setData('treeBox',[{
title: '江西'
,id: 1
,children: [{
title: '南昌'
,id: 1000
,children: [{
title: '青山湖区'
,id: 10001
},{
title: '高新区'
,id: 10002
}]
},{
title: '九江'
,id: 1001
},{
title: '赣州'
,id: 1002
}]
},{
title: '广西'
,id: 2
,children: [{
title: '南宁'
,id: 2000
},{
title: '桂林'
,id: 2001
}]
},{
title: '陕西'
,id: 3
,children: [{
title: '西安'
,id: 3000
},{
title: '延安'
,id: 3001
}]
}])
- 示例:pktree.setData('treeBox',[{
showLine(objectname, data),是否开启连接线。
- 是否开启连接线。默认 true,不开启连线,,若设为 false,则节点左侧出现三角图标。
- 示例:pktree.showLine('treeBox',false);
showCheckBox(objectname, data),是否显示复选框。
- 显示:true,不显示:false
- pktree.showCheckBox('treeBox',true);
- setStyle(objectname, data) 设置控件样式
- 示例:pktree.setStyle('treeBox',{'bgColor':'cyan','fontColor':'red','iconColor':'yellow','activeBgcolor':'blue'})
- bgColor:背景色
- fontColor:文字颜色
- iconColor:箭头图标颜色
- activeBgcolor:鼠标移入状态背景色
- 示例:pktree.setStyle('treeBox',{'bgColor':'cyan','fontColor':'red','iconColor':'yellow','activeBgcolor':'blue'})
- getValue(objectname),获得复选框选中的节点。
- 示例:pktree.getValue('treeBox'); 返回示例:[{title: '油条',id: 5},{title: '包子',id: 6},{title: '豆浆',id: 7}]
- refresh(objectname),刷新树控件
- 示例:pktree.refresh('treeBox');
isShow(objectname) 显示控件
- 示例:pktree.isShow('treeBox');
isHide(objectname) 隐藏控件
- 示例:pktree.isHide('treeBox');
...