changeset 18:c5fffe4338a1

with clickable nodes now.
author casties
date Wed, 07 Oct 2015 16:27:29 +0200
parents 09c0a9ceb778
children 2b2699d47eba
files ismi-python-neo4jrestclient/static/commentaries_authors2.html
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ismi-python-neo4jrestclient/static/commentaries_authors2.html	Wed Oct 07 15:41:00 2015 +0200
+++ b/ismi-python-neo4jrestclient/static/commentaries_authors2.html	Wed Oct 07 16:27:29 2015 +0200
@@ -97,6 +97,7 @@
 <script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" type="text/javascript"></script>
 <script type="text/javascript">
     backendApiPrefix = "";
+    searchApi = {};
     $(function () {
         function showText(text_id) {
             $.get(backendApiPrefix+"/textandcommentaries/" + encodeURIComponent(text_id),
@@ -154,7 +155,10 @@
                     }, "json");
             return false;
         }
-
+        // export API
+        searchApi.showText = showText;
+        searchApi.search = search;
+        // start search
         $("#search").submit(search);
         search();
     })
@@ -186,8 +190,15 @@
                 .append("circle")
                 .attr("class", function (d) { return "node "+d.label+" ismi-"+d.ismi_id})
                 .attr("r", 8) // 10
+                .attr("data-ismi_id", function(d) {return d.ismi_id})
+                .on("click", function() {
+                    console.log("click on ", this);
+                    var id = this.getAttribute("data-ismi_id");
+                    searchApi.showText(id);
+                    })
                 .call(force.drag);
 
+        console.log("searchApi:", searchApi);
         // html title attribute
         node.append("title")
                 .text(function (d) { return d.title; })