// Go ahed and play ...
function enrich(node) {
var desc = 0
var childCount = 0
if (node['children']) {
$.each(node['children'], function(i, child) {
desc += child['descendants'] + 1
})
childCount = node['children'].length
}
node['descendants'] = desc
node['childCount'] = childCount
}
function renderItem(tr, item){
tr.append($('<td>' + item.name.toUpperCase() + '</td>'))
tr.append($('<td colspan="5"><a " href="https://en.wikipedia.org/wiki/'+item.geb+'" target="inWikipedia" >' + item.geb + '</a></td>'))
}
var options = {
mountPoint : $('#container'),
idAttr : 'name',
renderedAttr : {
name : 'Name',
childCount : '# Children',
descendants : '# Descendants',
geb : 'Year of birth'
},
depthFirst : enrich,
replaceContent : true,
tableAttributes : {
// class : 'orange'
},
slider :true,
initialExpandLevel : 4,
//renderer : renderItem,
controls : [
//$('<button onclick="alert(jsTreeTable)">Show version</button>'),
//$('<span>Just some text</span>')
]
}
appendTreetable(makeTree(makeData(), 'name'), options)
table loading