So, I have a problem, and this is most likely because I still do not get JavaScript ... Cytoscape has its own 'this', and Polymer has 'this'
<div id="labelFld">{{node.label}}</div> <div id="measureFld">{{node.measure}}</div> <div id="timesignatureFld">{{node.time_signature}}</div> <div id="voiceFld">{{node.voice}}</div> <div id="beatFld">{{node.beat}}</div> <div id="meventFld">{{node.event}}</div>
var cy; cytoscape({ ready : function () { Polymer: ({ ... properties : { node : { type : Object, notify : true, readOnly : true } }, ...
But to update my <div>{{node.label}}</div> I have to be able to do this.node.label = "N42" // Polymer , but I cannot do this in cy.on('click','node', ... ) because I need this.data() // Cytoscape inside.
Scope really kills me about this.
EDIT
In the end, I created an Observer to view and update:
self_node = this.selectedNode; var poly = this; Object.observe(self_node, function(changes) { changes.forEach(function(change) { if(change.type == "update") { poly.selectedNode = { "id": change.object.id, ... } }; poly.notifyPath('selectedNode.id', change.object.id); } });}.bind(poly));
source share