Left Click Configuration #480

Closed
DavidMuller opened this Issue May 27, 2014 · 7 comments

Comments

Projects
None yet
2 participants
@DavidMuller

Hello,

I'm having difficulty with left click configuration. I inserted some left click customization verbatim from the JBrowse Configuration page to the yeast "Protein-Coding genes" track provided with JBrowse 1.11.4, as in:
"onClick" : {
"iconClass" : "dijitIconDatabase",
"action" : "iframeDialog",
"url" : "http://www.ncbi.nlm.nih.gov/gquery/?term={name}",
"label" : "Search for {name} at NCBI",
"title" : "function(track,feature,div) { return 'Searching for '+feature.get('name')+' at NCBI'; }"
}

When I click on a gene, a pop-up does appear searching NCBI with the name of the gene I've clicked on. However, a mouse hover over the feature reads only as: "Search for {name} at NCBI." Any idea what could be causing this?

Thanks for your help!

-David

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin May 27, 2014

Contributor

I see what you mean. This seems specific to the label though, because for example the URL component in "onClick" : { "label": "search at NCBI", "url": "http://www.ncbi.nlm.nih.gov/gquery/?term={name}" } renders the name correctly.

See:
http://gmod.org/wiki/JBrowse_Configuration_Guide#Customizing_Left-click_Behavior

Contributor

cmdcolin commented May 27, 2014

I see what you mean. This seems specific to the label though, because for example the URL component in "onClick" : { "label": "search at NCBI", "url": "http://www.ncbi.nlm.nih.gov/gquery/?term={name}" } renders the name correctly.

See:
http://gmod.org/wiki/JBrowse_Configuration_Guide#Customizing_Left-click_Behavior

@DavidMuller

This comment has been minimized.

Show comment
Hide comment
@DavidMuller

DavidMuller May 27, 2014

Right, in that example, it is specific to the label. However, if you change the configuration to a custom JavaScript function (as described in http://gmod.org/wiki/JBrowse_Configuration_Guide#Click_Configuration_Options), you can't actually access the name of the feature in the JavaScript:
"onClick" : {
"action" : "function(track,feature,div) { alert('You clicked on '+feature.get('name')+' in JBrowse'); }"
}

This alert does not appear on a click; it throws a type error: Uncaught TypeError: Cannot read property 'get' of undefined.

What this boils down to is me wanting to access the name of the feature in custom JavaScript for a click action. Is there a work around? Thanks.

-David

Right, in that example, it is specific to the label. However, if you change the configuration to a custom JavaScript function (as described in http://gmod.org/wiki/JBrowse_Configuration_Guide#Click_Configuration_Options), you can't actually access the name of the feature in the JavaScript:
"onClick" : {
"action" : "function(track,feature,div) { alert('You clicked on '+feature.get('name')+' in JBrowse'); }"
}

This alert does not appear on a click; it throws a type error: Uncaught TypeError: Cannot read property 'get' of undefined.

What this boils down to is me wanting to access the name of the feature in custom JavaScript for a click action. Is there a work around? Thanks.

-David

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin May 27, 2014

Contributor

I have seen that function format in our documentation but you are right, it doesn't seem to work. I'm not sure if it's been deprecated or what! If you want, I think you can just use this.feature.get('name') instead (this seemed to work for me)

Also, be careful because you have an apostrophe "You've" inside of the string 👍

Also, checkout the volvox example code for an interesting way to achieve the onclick functionality (specifically the functions.conf file)

I will keep this open to see if we can either resolve these issues or clarify the documentation...

Contributor

cmdcolin commented May 27, 2014

I have seen that function format in our documentation but you are right, it doesn't seem to work. I'm not sure if it's been deprecated or what! If you want, I think you can just use this.feature.get('name') instead (this seemed to work for me)

Also, be careful because you have an apostrophe "You've" inside of the string 👍

Also, checkout the volvox example code for an interesting way to achieve the onclick functionality (specifically the functions.conf file)

I will keep this open to see if we can either resolve these issues or clarify the documentation...

@DavidMuller

This comment has been minimized.

Show comment
Hide comment
@DavidMuller

DavidMuller May 27, 2014

Woops, sorry I just threw that "You've" into my email make it clear what I was talking about.

Cool, yeah using this.feature.get('name') worked for me as well.

Great, thanks for the pointer to the Volvox example functions, and looking forward to seeing updates to the documentation if that function format is, in fact, deprecated.

Thanks for the help!

-David

Woops, sorry I just threw that "You've" into my email make it clear what I was talking about.

Cool, yeah using this.feature.get('name') worked for me as well.

Great, thanks for the pointer to the Volvox example functions, and looking forward to seeing updates to the documentation if that function format is, in fact, deprecated.

Thanks for the help!

-David

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Oct 13, 2014

Contributor

I fixed the problem of the template parameters not being loaded for the mouseover here 8e51f7c

The documentation problem will aim to be fixed shortly as well

Contributor

cmdcolin commented Oct 13, 2014

I fixed the problem of the template parameters not being loaded for the mouseover here 8e51f7c

The documentation problem will aim to be fixed shortly as well

@cmdcolin cmdcolin closed this Oct 13, 2014

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Oct 13, 2014

Contributor

For the "action" parameter in particular, the callback parameter is different for CanvasFeatures, so I updated the documentation

Contributor

cmdcolin commented Oct 13, 2014

For the "action" parameter in particular, the callback parameter is different for CanvasFeatures, so I updated the documentation

cmdcolin added a commit that referenced this issue Oct 16, 2014

cmdcolin added a commit that referenced this issue Oct 17, 2014

Add a 'defaultDialog' option for onClick actions for when you just wa…
…nt a mouseover but don't need a custom action. See #480

cmdcolin added a commit that referenced this issue Oct 17, 2014

@cmdcolin cmdcolin added this to the 1.11.6 milestone Jan 23, 2015

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Feb 13, 2015

Contributor

There are examples of this in the volvox browser config in case anyone lands on this issue. Also see the http://gmod.org/wiki/JBrowse_Configuration_Guide#Customizing_Mouse-over_behavior section in the JBrowse configuration guide

Contributor

cmdcolin commented Feb 13, 2015

There are examples of this in the volvox browser config in case anyone lands on this issue. Also see the http://gmod.org/wiki/JBrowse_Configuration_Guide#Customizing_Mouse-over_behavior section in the JBrowse configuration guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment