{"action":"closed","issue":{"url":"https://api.github.com/repos/handsontable/handsontable/issues/3226","repository_url":"https://api.github.com/repos/handsontable/handsontable","labels_url":"https://api.github.com/repos/handsontable/handsontable/issues/3226/labels{/name}","comments_url":"https://api.github.com/repos/handsontable/handsontable/issues/3226/comments","events_url":"https://api.github.com/repos/handsontable/handsontable/issues/3226/events","html_url":"https://github.com/handsontable/handsontable/issues/3226","id":133273773,"number":3226,"title":"Context Menu items as a function","user":{"login":"bdr99","id":2292715,"avatar_url":"https://avatars.githubusercontent.com/u/2292715?v=3","gravatar_id":"","url":"https://api.github.com/users/bdr99","html_url":"https://github.com/bdr99","followers_url":"https://api.github.com/users/bdr99/followers","following_url":"https://api.github.com/users/bdr99/following{/other_user}","gists_url":"https://api.github.com/users/bdr99/gists{/gist_id}","starred_url":"https://api.github.com/users/bdr99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdr99/subscriptions","organizations_url":"https://api.github.com/users/bdr99/orgs","repos_url":"https://api.github.com/users/bdr99/repos","events_url":"https://api.github.com/users/bdr99/events{/privacy}","received_events_url":"https://api.github.com/users/bdr99/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/handsontable/handsontable/labels/Answered","name":"Answered","color":"006b75"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-12T15:48:20Z","updated_at":"2016-03-07T13:42:58Z","closed_at":"2016-03-07T13:42:58Z","body":"I am building an application in which I want the context menu items to vary depending on some conditions. But it doesn't look like I can set the context menu items to a function which returns the items. In other words:\r\n\r\nThis works:\r\n```javascript\r\ncontextMenu: {\r\n  items: {\r\n    \"row_below\": {}\r\n  }\r\n}\r\n```\r\nBut this does not (gives the error `Uncaught TypeError: Cannot read property 'name' of undefined`)\r\n```javascript\r\ncontextMenu: {\r\n  items: function(){\r\n    return {\r\n      \"row_below\": {}\r\n    };\r\n  }\r\n}\r\n```\r\nIs this expected behavior? Is there a way to have the context menu items dynamic?"}}