{"action":"created","issue":{"url":"https://api.github.com/repos/jupyter-incubator/declarativewidgets/issues/379","repository_url":"https://api.github.com/repos/jupyter-incubator/declarativewidgets","labels_url":"https://api.github.com/repos/jupyter-incubator/declarativewidgets/issues/379/labels{/name}","comments_url":"https://api.github.com/repos/jupyter-incubator/declarativewidgets/issues/379/comments","events_url":"https://api.github.com/repos/jupyter-incubator/declarativewidgets/issues/379/events","html_url":"https://github.com/jupyter-incubator/declarativewidgets/issues/379","id":157973616,"number":379,"title":"How do I print a result in a cell based on the selection on a widget in another cell?","user":{"login":"paulperry","id":501736,"avatar_url":"https://avatars.githubusercontent.com/u/501736?v=3","gravatar_id":"","url":"https://api.github.com/users/paulperry","html_url":"https://github.com/paulperry","followers_url":"https://api.github.com/users/paulperry/followers","following_url":"https://api.github.com/users/paulperry/following{/other_user}","gists_url":"https://api.github.com/users/paulperry/gists{/gist_id}","starred_url":"https://api.github.com/users/paulperry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulperry/subscriptions","organizations_url":"https://api.github.com/users/paulperry/orgs","repos_url":"https://api.github.com/users/paulperry/repos","events_url":"https://api.github.com/users/paulperry/events{/privacy}","received_events_url":"https://api.github.com/users/paulperry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-06-01T18:19:24Z","updated_at":"2016-06-10T13:58:09Z","closed_at":null,"body":"I'm new to this UI stuff.  In dashboards, cells are units of layout (I can place them where I want), and I don't know of a way to execute a cell when in dashboard layout (I don't think there is).   I'd like to print or plot in a cell based on the selection on a viz-table in another cell, automatically.  How do I do that?  For example, If in one cell I have:\r\n\r\n```\r\n%%html\r\n<template is=\"urth-core-bind\">\r\n    <urth-core-function ref=\"get_row\" arg-idx=\"[[sel1.0]]\" result=\"{{res}}\" auto>\r\n    </urth-core-function>\r\n    <urth-core-dataframe id='df1' ref=\"df1\" value=\"{{df1}}\" auto></urth-core-dataframe>\r\n    <urth-viz-table datarows=\"{{df1.data}}\" columns=\"{{df1.columns}}\" selection=\"{{sel1}}\" rows-visible=6>\r\n        </urth-viz-table>\r\n</template>\r\n```\r\n\r\nHow do I print or plot what get_row() might output in another cell?  What would the code look like in that second cell? Here is sample code to support the cell above:\r\n\r\n```\r\nimport pandas as pd\r\ndf1 = pd.DataFrame([[1,2],[3,4]], columns=['a','b'])\r\ndf1.columns.name = 'df1'\r\ndf2 = pd.DataFrame([[5,6],[7,8]], columns=['c','d'])\r\ndf2.columns.name = 'df2'\r\ndf3 = pd.DataFrame([[9,10],[11,12]], columns=['e','f'])\r\ndf3.columns.name = 'df3'\r\n\r\ndef get_row(idx:int):\r\n    global df1, df2\r\n    if idx > 1:\r\n        print(df3)  # or df3.plot(()\r\n    else:\r\n        print(df2)\r\n\r\n```\r\n\r\n```\r\n%%html\r\n<link rel=\"import\" href=\"urth_components/urth-viz-table/urth-viz-table.html\" is=\"urth-core-import\">\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/jupyter-incubator/declarativewidgets/issues/comments/225189037","html_url":"https://github.com/jupyter-incubator/declarativewidgets/issues/379#issuecomment-225189037","issue_url":"https://api.github.com/repos/jupyter-incubator/declarativewidgets/issues/379","id":225189037,"user":{"login":"lbustelo","id":2474841,"avatar_url":"https://avatars.githubusercontent.com/u/2474841?v=3","gravatar_id":"","url":"https://api.github.com/users/lbustelo","html_url":"https://github.com/lbustelo","followers_url":"https://api.github.com/users/lbustelo/followers","following_url":"https://api.github.com/users/lbustelo/following{/other_user}","gists_url":"https://api.github.com/users/lbustelo/gists{/gist_id}","starred_url":"https://api.github.com/users/lbustelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbustelo/subscriptions","organizations_url":"https://api.github.com/users/lbustelo/orgs","repos_url":"https://api.github.com/users/lbustelo/repos","events_url":"https://api.github.com/users/lbustelo/events{/privacy}","received_events_url":"https://api.github.com/users/lbustelo/received_events","type":"User","site_admin":false},"created_at":"2016-06-10T13:58:09Z","updated_at":"2016-06-10T13:58:09Z","body":"@paulperry Can we close this?"}}
{"actor":{"display_login":"lbustelo"}}