Properly use click event

pull/14/merge
Raphaël Vinot 2017-10-04 17:09:00 +02:00
parent 5102546789
commit 8b353e3e76
1 changed files with 4 additions and 4 deletions

View File

@ -80,8 +80,8 @@ function getBB(selection) {
}) })
} }
function urlnode_click(uuid) { function urlnode_click(data) {
var url = "url/" + uuid; var url = "url/" + data['uuid'];
d3.json(url, function(error, u) { d3.json(url, function(error, u) {
if (error) throw error; if (error) throw error;
console.log(u) console.log(u)
@ -105,12 +105,12 @@ function hostnode_click(d) {
var list = hostnode_tooltip.append('ul') var list = hostnode_tooltip.append('ul')
.attr("class", "list-group"); .attr("class", "list-group");
urls.forEach(function(url){ urls.forEach(function(url){
jdata = JSON.parse(url) var jdata = JSON.parse(url)
var entry = list.append('li') var entry = list.append('li')
.attr("class", "list-group-item") .attr("class", "list-group-item")
.attr("url_uuid", jdata['uuid']) .attr("url_uuid", jdata['uuid'])
.text(jdata['name']) .text(jdata['name'])
.on('click', urlnode_click(jdata['uuid'])); .on('click', function(){urlnode_click(jdata)});
}) })
}); });
} }