diff --git a/examples/graph/02_random_nodes.html b/examples/graph/02_random_nodes.html
index a3de91a5..b048a69d 100755
--- a/examples/graph/02_random_nodes.html
+++ b/examples/graph/02_random_nodes.html
@@ -88,7 +88,7 @@
// add event listeners
vis.events.addListener(graph, 'select', function(params) {
document.getElementById('selection').innerHTML =
- 'Selection: ' + JSON.stringify(graph.getSelection());
+ 'Selection: ' + graph.getSelection();
});
}
diff --git a/examples/graph/07_selections.html b/examples/graph/07_selections.html
index 25c761e2..421c3794 100644
--- a/examples/graph/07_selections.html
+++ b/examples/graph/07_selections.html
@@ -52,24 +52,13 @@
// add event listener
function onSelect() {
- var selection = graph.getSelection();
-
- var info = 'selection: ';
- selection.forEach(function (s) {
- info += s.row + ' ';
- });
-
- document.getElementById('info').innerHTML += info + '
';
+ document.getElementById('info').innerHTML +=
+ 'selection: ' + graph.getSelection().join(', ') + '
';
}
vis.events.addListener(graph, 'select', onSelect);
- // set initial selection (row based, zero-based)
- var selection = [
- {'row': 2},
- {'row': 3},
- {'row': 4}
- ];
- graph.setSelection(selection);
+ // set initial selection (id's of some nodes)
+ graph.setSelection([3, 4, 5]);