Re: Documentation question

23 views
Skip to first unread message

Max Franz

unread,
May 23, 2013, 12:48:19 PM5/23/13
to cytoscap...@googlegroups.com
You've found a typo in the docs.  I'll fix that soon.  Thanks! -Max

On Monday, May 20, 2013 3:12:48 PM UTC-4, dms wrote:
Hi there, I was trying to have and clicked event to display some ONLY nodes information, and following documentation I was getting some errors


Documentation:

Examples

Bind to events that bubble up from elements matching the specified nodes selector:

cy.on('click', 'nodes', { foo: 'bar' }, function(evt){
  console.log( evt.data.foo ); // 'bar'

  var node = this;
  console.log( 'clicked ' + node.id() );
});

I was getting on console: The selector `%s` is invalid

When I changed to 'node'(singular) instead of 'nodes' it started working.

Am I doing something wrong ? if so, what is the difference from node / nodes ? (is nodes a collection of node )

Here is my code working:

cy.on('select', 'node', function(event){
         var evtTarget = event.cyTarget;
         window.evtTarget = evtTarget;
       //debugger;
         if( evtTarget === cy ){
             console.log('click on background');
         } else {
           console.log('click on some element');
           console.log("clicked on " + evtTarget.data("id"));
         }}) //end-of select

Cheers.,

Bumbu Alex

unread,
May 23, 2013, 3:55:16 PM5/23/13
to cytoscape-discuss
Hy dms,

As documentation is a github page you could do fix this bug and make a pull request. It will be a much faster process. Also each pull request has a discussion thread on github issues, so all the discussions regarding found bugs can be kept right near proposed solution.
Reply all
Reply to author
Forward
0 new messages