{"action":"created","issue":{"url":"https://api.github.com/repos/swisnl/jQuery-contextMenu/issues/654","repository_url":"https://api.github.com/repos/swisnl/jQuery-contextMenu","labels_url":"https://api.github.com/repos/swisnl/jQuery-contextMenu/issues/654/labels{/name}","comments_url":"https://api.github.com/repos/swisnl/jQuery-contextMenu/issues/654/comments","events_url":"https://api.github.com/repos/swisnl/jQuery-contextMenu/issues/654/events","html_url":"https://github.com/swisnl/jQuery-contextMenu/issues/654","id":344150033,"node_id":"MDU6SXNzdWUzNDQxNTAwMzM=","number":654,"title":"setInputValues in submenu","user":{"login":"GiselleSerate","id":13649793,"node_id":"MDQ6VXNlcjEzNjQ5Nzkz","avatar_url":"https://avatars0.githubusercontent.com/u/13649793?v=4","gravatar_id":"","url":"https://api.github.com/users/GiselleSerate","html_url":"https://github.com/GiselleSerate","followers_url":"https://api.github.com/users/GiselleSerate/followers","following_url":"https://api.github.com/users/GiselleSerate/following{/other_user}","gists_url":"https://api.github.com/users/GiselleSerate/gists{/gist_id}","starred_url":"https://api.github.com/users/GiselleSerate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GiselleSerate/subscriptions","organizations_url":"https://api.github.com/users/GiselleSerate/orgs","repos_url":"https://api.github.com/users/GiselleSerate/repos","events_url":"https://api.github.com/users/GiselleSerate/events{/privacy}","received_events_url":"https://api.github.com/users/GiselleSerate/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-24T18:20:51Z","updated_at":"2018-08-22T14:38:02Z","closed_at":null,"author_association":"NONE","body":"If I want to set the checkedness of a radio button that's in a submenu, the general events show and hide for the entire context menu doesn't seem to be able to set the data. I've also tried using `getInputValues()` to get the values once I've checked one of the radio buttons, but it's returning a blank object as well. What's the best way to do this? \r\n\r\nIt would be less nice, but is there a way of using each radio button's events to get the variable on show? What about checking on showing the submenu? (I tried using events > show for both of these, but perhaps I didn't do it properly.) \r\n\r\nThe structure of my context menu is replicated below. Thank you in advance. \r\n```\r\n// Context menu for other platforms.\r\n$.contextMenu({\r\n  selector: '#mySelector',\r\n  callback: function(key) {\r\n    myCallback();\r\n  },\r\n  items: {\r\n    item1: {\r\n      name: \"Item 1\"\r\n    },\r\n    hasSubItems: { \r\n      name: \"Has SubItems\",\r\n      items: {\r\n        rad0: {\r\n          name: \"Rad0\",\r\n          type: \"radio\",\r\n          radio: \"myRadio\",\r\n          events: {\r\n            change: function(e) {\r\n              console.log('changed 0');\r\n            },\r\n            show: function(e) {\r\n              console.log('Not helpful');\r\n            }\r\n          }\r\n        },\r\n        rad1: {\r\n          name: \"Rad1\",\r\n          type: \"radio\",\r\n          radio: \"myRadio\",\r\n          events: {\r\n            change: function(e) {\r\n              console.log('changed 1');\r\n            },\r\n          }\r\n        }\r\n      },\r\n      events: {\r\n        show: function(opt) {\r\n          console.log(opt);\r\n          console.log('This function also never runs');\r\n        }\r\n      }\r\n    },\r\n  },\r\n  events: {\r\n    show: function(opt) {\r\n      console.log(opt);\r\n      var data = {};\r\n      if(externalVar == 1) {\r\n        data = {rad1: true};\r\n      }\r\n      else {\r\n        data = {rad0: true};\r\n      }\r\n      console.log('Setting values.');\r\n      console.log(data);\r\n      $.contextMenu.setInputValues(opt, data);\r\n    }, \r\n    hide: function(opt) {\r\n      console.log('Getting values.');\r\n      var data = {};\r\n      $.contextMenu.getInputValues(opt, data);\r\n      console.log(data);\r\n    }, \r\n  }\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/swisnl/jQuery-contextMenu/issues/comments/415055289","html_url":"https://github.com/swisnl/jQuery-contextMenu/issues/654#issuecomment-415055289","issue_url":"https://api.github.com/repos/swisnl/jQuery-contextMenu/issues/654","id":415055289,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTA1NTI4OQ==","user":{"login":"djiest","id":1582516,"node_id":"MDQ6VXNlcjE1ODI1MTY=","avatar_url":"https://avatars0.githubusercontent.com/u/1582516?v=4","gravatar_id":"","url":"https://api.github.com/users/djiest","html_url":"https://github.com/djiest","followers_url":"https://api.github.com/users/djiest/followers","following_url":"https://api.github.com/users/djiest/following{/other_user}","gists_url":"https://api.github.com/users/djiest/gists{/gist_id}","starred_url":"https://api.github.com/users/djiest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djiest/subscriptions","organizations_url":"https://api.github.com/users/djiest/orgs","repos_url":"https://api.github.com/users/djiest/repos","events_url":"https://api.github.com/users/djiest/events{/privacy}","received_events_url":"https://api.github.com/users/djiest/received_events","type":"User","site_admin":false},"created_at":"2018-08-22T14:38:02Z","updated_at":"2018-08-22T14:38:02Z","author_association":"NONE","body":"Maybe related, maybe not\r\nCheck out these fiddles\r\n\r\nhttps://jsfiddle.net/xba5u4kf/\r\nThis one has NO events defined, and here the checkbox ('Boolean') and radiobutton ('Radio2') are selected as defined\r\nChanging the state of a checkbox or radiobutton has NO effect, after closing and opening the contextmenu, the default state is restored\r\n\r\nhttps://jsfiddle.net/xpvt214o/659394/\r\nThis is the same set up, however WITH events defined. Now the checkbox  ('Boolean') and radiobutton ('Radio2') AREN'T selected,  although defined\r\nChanging the state of a checkbox or radiobutton HAS effect, after closing and opening the contextmenu, the changed state is maintained\r\n\r\n"}}
{"actor":{"display_login":"djiest"}}