{"action":"created","issue":{"url":"https://api.github.com/repos/datastorm-open/rAmCharts/issues/59","repository_url":"https://api.github.com/repos/datastorm-open/rAmCharts","labels_url":"https://api.github.com/repos/datastorm-open/rAmCharts/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/datastorm-open/rAmCharts/issues/59/comments","events_url":"https://api.github.com/repos/datastorm-open/rAmCharts/issues/59/events","html_url":"https://github.com/datastorm-open/rAmCharts/issues/59","id":168385597,"number":59,"title":"Shiny.onInputChange() in Shiny module not working","user":{"login":"JianWang2016","id":991464,"avatar_url":"https://avatars.githubusercontent.com/u/991464?v=3","gravatar_id":"","url":"https://api.github.com/users/JianWang2016","html_url":"https://github.com/JianWang2016","followers_url":"https://api.github.com/users/JianWang2016/followers","following_url":"https://api.github.com/users/JianWang2016/following{/other_user}","gists_url":"https://api.github.com/users/JianWang2016/gists{/gist_id}","starred_url":"https://api.github.com/users/JianWang2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JianWang2016/subscriptions","organizations_url":"https://api.github.com/users/JianWang2016/orgs","repos_url":"https://api.github.com/users/JianWang2016/repos","events_url":"https://api.github.com/users/JianWang2016/events{/privacy}","received_events_url":"https://api.github.com/users/JianWang2016/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-29T18:28:52Z","updated_at":"2016-09-08T16:56:06Z","closed_at":null,"body":"Hi, \r\nI am trying to capture rAmCharts click event in shiny. \r\nThe [example](http://datastorm-open.github.io/introduction_ramcharts/shiny.html)  works great until the codes are adapted for shiny modules.   Any advice on how to change shiny.onInputChange() javascript is greatly appreciated.\r\n\r\nHere is the code from rAmCharts Getting Started section:\r\n\r\n`\r\nrequire(shiny)\r\n\r\nshinyApp(\r\n  ui = fluidPage(\r\n    amChartsOutput(outputId = \"amchart\"),\r\n    fluidRow(\r\n      column(width = 1, strong(\"Values: \")),\r\n      column(width = 3, verbatimTextOutput(\"click\"))\r\n    )\r\n  ),\r\n  \r\n  server =  function(input, output) {\r\n    output$amchart <- renderAmCharts({\r\n      # build the chart\r\n      pipeR::pipeline(\r\n        amBoxplot(iris[, -5]),\r\n        addListener(name = 'clickGraphItem',\r\n                    expression = paste('function (event) {',\r\n                                       'Shiny.onInputChange(\\'myValues\\', event.item.values);',\r\n                                       '}'))\r\n      )\r\n    })\r\n    \r\n    output$click <- renderPrint(input$myValues)\r\n  }\r\n)\r\n`\r\nHere is the module UI and Server codes in a file named testClickModule.R.  The graph still displays but the click event is not registered.  I get a sense that the name space is the culprit but didn't manage to get it working after testing session$ns.\r\n\r\n`\r\nclickMeUI <- function(id) {\r\n  ns <- NS(id)\r\n\r\n  tagList(\r\n    amChartsOutput(outputId = ns(\"amchart\")),\r\n    fluidRow(\r\n      column(width = 1, strong(\"Values: \")),\r\n      column(width = 3, verbatimTextOutput(ns(\"click\")))\r\n    )\r\n  )\r\n} \r\n  \r\nclickMe <- function(input, output, session) {\r\n  \r\n    output$amchart <- renderAmCharts({\r\n      # build the chart\r\n      pipeR::pipeline(\r\n        amBoxplot(iris[, -5]),\r\n        addListener(name = 'clickGraphItem',\r\n                    expression = paste('function (event) {',\r\n                                       'Shiny.onInputChange(\\'myValues\\', event.item.values);',\r\n                                       '}'))\r\n      )\r\n    })\r\n\r\n    output$click <- renderPrint(input$myValues)\r\n}\r\n\r\n\r\n`\r\n\r\nHere is the app.R using the module defined above\r\n\r\n`\r\nlibrary(shiny)\r\nlibrary(rAmCharts)\r\n\r\nsource(\"testClickModule.R\", local=TRUE)\r\n\r\nui <- fixedPage(\r\n  h2(\"Module example\"),\r\n  clickMeUI(\"testClick\")\r\n)\r\n\r\nserver <- function(input, output, session) {\r\n callModule(clickMe, \"testClick\") \r\n  \r\n} \r\n\r\n\r\nshinyApp(ui, server)\r\n`\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/datastorm-open/rAmCharts/issues/comments/245664361","html_url":"https://github.com/datastorm-open/rAmCharts/issues/59#issuecomment-245664361","issue_url":"https://api.github.com/repos/datastorm-open/rAmCharts/issues/59","id":245664361,"user":{"login":"debsush","id":15077449,"avatar_url":"https://avatars.githubusercontent.com/u/15077449?v=3","gravatar_id":"","url":"https://api.github.com/users/debsush","html_url":"https://github.com/debsush","followers_url":"https://api.github.com/users/debsush/followers","following_url":"https://api.github.com/users/debsush/following{/other_user}","gists_url":"https://api.github.com/users/debsush/gists{/gist_id}","starred_url":"https://api.github.com/users/debsush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debsush/subscriptions","organizations_url":"https://api.github.com/users/debsush/orgs","repos_url":"https://api.github.com/users/debsush/repos","events_url":"https://api.github.com/users/debsush/events{/privacy}","received_events_url":"https://api.github.com/users/debsush/received_events","type":"User","site_admin":false},"created_at":"2016-09-08T16:56:06Z","updated_at":"2016-09-08T16:56:06Z","body":"Try changing the below\r\nShiny.onInputChange(\\'myValues\\', event.item.values);\r\nto\r\nShiny.onInputChange(myValues, event.item.values);"}}
{"actor":{"display_login":"debsush"}}