Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the function getNodeByLabel(label) #40

Closed
ghost opened this issue Jun 22, 2012 · 3 comments
Closed

add the function getNodeByLabel(label) #40

ghost opened this issue Jun 22, 2012 · 3 comments

Comments

@ghost
Copy link

ghost commented Jun 22, 2012

hello,

as the function getNodeById(id), it is possible to do a function to search by a label ?

thanks.

@mbraak
Copy link
Owner

mbraak commented Jun 22, 2012

There is a getNodeByName function. Not documented yet.

$('#tree1').getNodeByName('node1');

@ghost
Copy link
Author

ghost commented Jun 25, 2012

i mean to search a label with the entire or partial label, with wildcards for example.

@mbraak
Copy link
Owner

mbraak commented Jun 25, 2012

JqTree does not support that. However, you can iterate over the tree nodes:

Example that searches for node 'xyz':

var tree = $tree.tree('getTree');

var result = null;

tree.iterate(
  function(node) {
    if (node.name == 'xyz') {
      result = node;
      return false; // stop iterating
    }
    else {
      return true; // continue iterating
    }
  }
);

@ghost ghost closed this as completed Jun 26, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant