How to use selector (queries) inside BokehJS

I am trying to retrieve all elements containing specific tag:

I tried the following 3 options

CustomJS(args=dict(rootDom=rootDom), code="""

 console.log(rootDom);

 //var found = rootDom.select("tags", "myColumn");
 //var found = rootDom.select({"tags", "myColumn"});
 //var found = rootDom.select({type: "tags", name: "myColumn"});

 console.log(found);

 """)

The first one works, but returns empty array. Others return exceptions “Invalid selector”.

The following code works properly on Python side:

elems = rootDom.select({"tags": 'myColumn'})

Thanks!

Tags are just arbitrary metadata that can be attached for searching the Python object graph. They are not related to dom selectors

···

On Nov 18, 2016, at 08:35, Meir Tseitlin [email protected] wrote:

I am trying to retrieve all elements containing specific tag:

I tried the following 3 options

CustomJS(args=dict(rootDom=rootDom), code="""

 console.log(rootDom);

 //var found = rootDom.select("tags", "myColumn");
 //var found = rootDom.select({"tags", "myColumn"});
 //var found = rootDom.select({type: "tags", name: "myColumn"});

 console.log(found);

 """)
The first one works, but returns empty array. Others return exceptions "Invalid selector".


The following code works properly on Python side:


elems = rootDom.select({“tags”: ‘myColumn’})



Thanks!

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f36a5168-d25d-4148-a91d-ec6f116f4a7f%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

This is exactly what I am willing to do - find object by arbitrary metadata, but on JS side.

Thanks

···

On Friday, November 18, 2016 at 4:32:51 PM UTC+2, Bryan Van de ven wrote:

Tags are just arbitrary metadata that can be attached for searching the Python object graph. They are not related to dom selectors

On Nov 18, 2016, at 08:35, Meir Tseitlin [email protected] wrote:

I am trying to retrieve all elements containing specific tag:

I tried the following 3 options

CustomJS(args=dict(rootDom=rootDom), code="""

 console.log(rootDom);

 //var found = rootDom.select("tags", "myColumn");
 //var found = rootDom.select({"tags", "myColumn"});
 //var found = rootDom.select({type: "tags", name: "myColumn"});

 console.log(found);

 """)
The first one works, but returns empty array. Others return exceptions "Invalid selector".


The following code works properly on Python side:


elems = rootDom.select({“tags”: ‘myColumn’})



Thanks!

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f36a5168-d25d-4148-a91d-ec6f116f4a7f%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I am trying to attach new classes by settings special tags on elements and than using JS to search for those tags and insert classes in tagged elements.

I am also missing a way to trigger BokehJS callback when HTML created…

···

On Friday, November 18, 2016 at 4:34:15 PM UTC+2, Meir Tseitlin wrote:

This is exactly what I am willing to do - find object by arbitrary metadata, but on JS side.

Thanks

On Friday, November 18, 2016 at 4:32:51 PM UTC+2, Bryan Van de ven wrote:

Tags are just arbitrary metadata that can be attached for searching the Python object graph. They are not related to dom selectors

On Nov 18, 2016, at 08:35, Meir Tseitlin [email protected] wrote:

I am trying to retrieve all elements containing specific tag:

I tried the following 3 options

CustomJS(args=dict(rootDom=rootDom), code="""

 console.log(rootDom);

 //var found = rootDom.select("tags", "myColumn");
 //var found = rootDom.select({"tags", "myColumn"});
 //var found = rootDom.select({type: "tags", name: "myColumn"});

 console.log(found);

 """)
The first one works, but returns empty array. Others return exceptions "Invalid selector".


The following code works properly on Python side:


elems = rootDom.select({“tags”: ‘myColumn’})



Thanks!

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f36a5168-d25d-4148-a91d-ec6f116f4a7f%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.