Skip to content
Prev Previous commit
Next Next commit
fix: tree_id, parent_id
  • Loading branch information
Karelkin committed Aug 20, 2020
commit fcf05a9c310adaf82661707465a02e2801426cda
9 changes: 6 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,20 @@
email: 'Owner',
first_name: 'Name',
last_name: 'Name',
id: '1',
tree_id: '1',
parent_id: '1',
children: [{
email: 'Label 2',
first_name: 'Name 2',
last_name: 'Name 2',
id: '2'
tree_id: '2',
parent_id: '2'
},{
email: 'Label 3',
first_name: 'Name 3',
last_name: 'Name 3',
id: '3'
tree_id: '3',
parent_id: '3'
}]
}
}),
Expand Down
9 changes: 6 additions & 3 deletions src/components/org-tree/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export function renderLabel (h, data, context) {
const email = data[props.props.email]
const first_name = data[props.props.first_name]
const last_name = data[props.props.last_name]
const id = data[props.props.id]
const tree_id = data[props.props.tree_id]
const parent_id = data[props.props.parent_id]
const renderContent = props.renderContent

// event handlers
Expand All @@ -84,16 +85,18 @@ export function renderLabel (h, data, context) {
const childNodes2 = []
const childNodes3 = []
const childNodes4 = []
const childNodes5 = []

if (typeof renderContent === 'function') {
let vnode = renderContent(h, data)

vnode && childNodes.push(email) && childNodes2.push(first_name) && childNodes3.push(last_name) && childNodes4.push(id)
vnode && childNodes.push(email) && childNodes2.push(first_name) && childNodes3.push(last_name) && childNodes4.push(tree_id) && childNodes5.push(parent_id)
} else {
childNodes.push(email)
childNodes2.push(first_name)
childNodes3.push(last_name)
childNodes4.push(id)
childNodes4.push(tree_id)
childNodes5.push(parent_id)
}

if (props.collapsable && !isLeaf(data, props.props.children)) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/org-tree/org-tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export default {
email: 'email',
first_name: 'first_name',
last_name: 'last_name',
id: 'id',
tree_id: 'tree_id',
parent_id: 'parent_id',
expand: 'expand',
children: 'children'
})
Expand Down