title: Need to dynamically add menuItem to HighCharts contextButton w/function defined by variable
body: <p>I'm trying to dynamically add a menu item to my HighChart to support dynamic drilldowns with a function name that is dynamically generated. I'm able to successfully add new menuItems to the existing contextButton when using statically defined functions like alerts, however, when I have a function defined using a var it won't invoke the proper function.
  the following is working:</p>
  
  <pre><code>var chartOptions = {
          chart: {
              renderTo: myChartDiv,
              zoomType: 'x',
              type: 'area'
              }, 
          exporting: {
              enabled: true,
              buttons: {
                  contextButton: {
                      menuItems: [{
                          text: 'My Test',
                          onclick: function() {
                              alert('success!');
                          }
                      }]
                  }}
              }};
  </code></pre>
  
  <p>However, as soon as I want to add a new menu item with a function defined in a variable, the call defined by the variable is skipped. ie:</p>
  
  <pre><code>var c1 = "chart1";
  var c2 = "chart2";
  var drilldownMethod = "toggleCharts('" + c1 + "','" + c2 + "')";
  var newDrilldown = {
      text: Show Chart 2,
      onclick: function () {alert('test1'); drilldownMethod; alert('test2') }
  };
  chartOptions.exporting.buttons.contextButton.menuItems.push(newDrilldown);
  </code></pre>
  
  <p>I do see the new menu item "Show Chart 2", and when I click it, I do get the alerts 'test1' and 'test2' appear; however, the function in the string variable "drilldownMethod" is never invoked (there's an alert in that method as well to prove the point).</p>
  
  <p>Any thoughts on how to accomplish this?</p>