title: widgetVar not working properly in p:repeat for printing Charts
body: <p>I'm trying to print a few chart objects generated inside a <code>&lt;p:repeat&gt;&lt;/p:repeat&gt;</code> tag.</p>
  
  <p>I know that the regular <code>&lt;p:printer&gt;</code> tag does not work with primefaces charts due to the use of HTML5 Canvas...es? Canvii?</p>
  
  <p>Either way, I grabbed <a href="https://stackoverflow.com/a/35213008/7591918" title="this JS function">this JS function</a> from another SO post, but I can't quite get it to work the way I want.</p>
  
  <p>This is my panel with charts:</p>
  
  <pre><code>&lt;script  type="text/javascript"&gt;
      function exportChart(component) {
          //export image
          $('#output').empty().append(PF(component).exportAsImage());
  
          //show the dialog
          PF('dlg').show();
      }
  &lt;/script&gt;
  
  &lt;p:dialog widgetVar="dlg" showEffect="fade" modal="false" header="Druckbares Diagramm als Bild" resizable="true"&gt;
      &lt;p:outputPanel id="output" layout="block" style="width:1000px;height:300px"/&gt;
      &lt;p:commandButton onClick="javascript:PF('dlg').hide()" value = "Schließen"/&gt;
  &lt;/p:dialog&gt;
  &lt;p:panel id="charts"&gt;
      &lt;p:repeat value="#{AttributeChartsController.kacModel.chartWrappers}" var="wrapper" style="height: #{wrapper.drawHeight}" &gt;
          &lt;p:chart type="bar" model="#{wrapper.chart}" style="height: #{wrapper.drawHeight}" widgetVar="#{wrapper.widgetVarIdStr}"/&gt;
  
          &lt;p:commandLink id="lnk#{wrapper.widgetVarIdStr}" onclick="print(#{wrapper.widgetVarIdStr})"&gt;Print&lt;/p:commandLink&gt;
      &lt;/p:repeat&gt;
  &lt;/p:panel&gt;
  </code></pre>
  
  <p>I set my <code>widgetVar</code> to <code>widgetVarIdStr</code> which is generated for each chart like this, kind of:</p>
  
  <pre><code>//these are values retrieved from a database
  long widgetVarId = 0;
  for(Entry&lt;String, HashMap&lt;String, String&gt;&gt; entry : keyAttribs.entrySet()) {
              this.chartWrappers.add(createChartWrapper(entry.getKey(), entry.getValue()));
              widgetVarId++;
          }
  
  private ChartWrapper createChartWrapper(String attribName, HashMap&lt;String, String&gt; keyValue) {
      //... create Chart, ChartSeries, enter values, etc
      wrapper.setWidgetVarId(widgetVarId);
      return wrapper;
  }
  </code></pre>
  
  <p>The result is this, however:</p>
  
  <p><a href="https://i.stack.imgur.com/1OXC0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1OXC0.png" alt="enter image description here"></a>
  The chart works, the print button is there and has the right value, but the widgetVar doesn't seem to get set properly within the <code>&lt;p:repeat&gt;</code> element. The <code>widgetVar</code> property is also nowhere to be found in the final generated source of the page, is that normal?</p>
  
  <p>Here is my chartWrapper, there's probably a more elegant way to do what I want to do here but I'll stick with it:</p>
  
  <pre><code>public class ChartWrapper {
      private HorizontalBarChartModel chart;
      private long drawHeight;
      private long widgetVarId;
  
      public HorizontalBarChartModel getChart() {
          return chart;
      }
      public void setChart(HorizontalBarChartModel chart) {
          this.chart = chart;
      }
      public long getDrawHeight() {
          return this.drawHeight();
      }
      public void setDrawHeight(long drawHeight) {
          this.drawHeight = drawHeight;
      }
      public String getDrawHeightStr() {
          return drawHeight+"px";
      }
      public long getWidgetVarId() {
          return widgetVarId;
      }
      public void setWidgetVarId(long widgetVarId) {
          this.widgetVarId = widgetVarId;
      }
      public String getWidgetVarIdStr() {
          return "attrChart"+widgetVarId;
      }
  }
  </code></pre>