参数名 | 类型 | 描述 | 默认值 |
url | String | url | null |
data | Object | 数据 | null |
checkbox | Bool | 是否复选框 | true |
autoCheckboxEven | Bool | 复选框联动 | true |
parentIcon | String | 父节点图标 | 'folder' |
childIcon | String | 子节点图标 | 'leaf' |
textFieldName | String | 文本字段名 | 'text' |
attribute | Array | 预加载的属性名 | ['id', 'url'] |
treeLine | Bool | 是否显示连接线 | true |
nodeWidth | Int | 节点宽度 | 90 |
statusName | String | 状态名 | '__status' |
isLeaf | Function | 是否子节点的判断函数 | null |
single | Bool | 是否单选 | false |
idFieldName | String | ID字段名 | null |
parentIDFieldName | String | 父节点字段 | 'pid' |
topParentIDValue | String | 顶级节点 | 0 |
slide | Bool | 是否显示动画 | true |
iconFieldName | String | 图标字段名 | 'icon' |
nodeDraggable | Bool | 是否允许拖拽 | false |
nodeDraggingRender | Function | null | |
btnClickToToggleOnly | Bool | 是否点击展开/收缩 按钮时才有效 | true |
needCancel | Bool | 已选的是否需要取消操作 | null |
ajaxType | String | 远程加载方式 | post |
render | Function | 自定义函数 | null |
selectable | Function | 可选择判断函数 | null |
1 var data = []; 2 3 data.push({ id: 1, pid: 0, text: '1' }); 4 data.push({ id: 2, pid: 1, text: '1.1' }); 5 data.push({ id: 4, pid: 2, text: '1.1.2' }); 6 data.push({ id: 5, pid: 2, text: '1.1.2' }); 7 8 data.push({ id: 10, pid: 8, text: 'wefwfwfe' }); 9 data.push({ id: 11, pid: 8, text: 'wgegwgwg' }); 10 data.push({ id: 12, pid: 8, text: 'gwegwg' }); 11 12 data.push({ id: 6, pid: 2, text: '1.1.3', ischecked: true }); 13 data.push({ id: 7, pid: 2, text: '1.1.4' }); 14 data.push({ id: 8, pid: 7, text: '1.1.5' }); 15 data.push({ id: 9, pid: 7, text: '1.1.6' }); 16 17 $("#tree1").ligerTree({ 18 data:data, 19 idFieldName :'id', 20 parentIDFieldName :'pid' 21 } 22 );