- Would like to create a node. If you click or select the node, there will be a message in the console.
- Here are the codes used.
nx.define('MyExtendNode', nx.graphic.Topology.Node, { view: function(view) { view.content[2].events.clickNode = this._nodeClick; return view; }, methods: { init: function(options) { this.inherited(options); }, dispose: function() { this.inherited(); }, _nodeClick: function(sender, event){ console.log('node clicked') } } });
- But there is no message in console. Want to create a customized Node class.
About your customized node class, you should do two small modification.
1. view.content[2].events.clickNode should be view.content[2].events.click
2. Because NeXt view engine will parse the view json. So you should follow the syntax of view definition. like:
view.content[2].events.click = "{#_nodeClick}"
Check out the below example for your reference.
http://codepen.io/NEXTSUPPORT/pen/YqONOj?editors=0010
For creating customized node class, you can refer these example. Extend - > Extend Node
Comments
0 comments
Please sign in to leave a comment.