2016-06-11 16 views
1

私はJavaScriptを使用して画像を生成し、モーダルに結果を示すが、モーダルの画像葉:http://s2.subirimagenes.com/imagen/9603018modal.pngモーダルでプライムフェイスチャートを表示するにはどうすればいいですか?

これは私のコードです:

XHTML

<h:form id = "form1"> 
    <p:chart widgetVar="chart" style="width:1200px;height:400px" type = "bar" model="#{graphicBean.barModel}" rendered="#{not empty graphicBean.barModel}"/> 
    <p:commandButton onclick ="exportChart()" value = "Execute"/> 
    <b:commandButton class="btn btn-primary" value="Show" ajax="true" oncomplete="$('.modalGraphic').modal();return false;" /> 
</h:form> 

<b:modal id="id_modalGraphic" styleClass="modalGraphic" title="Guarda el gráfico"> 
    <h:form id = "resultado"> 
     <h:panelGroup id="output" layout="block" style="width:100px;height:100px"></h:panelGroup> 
    </h:form> 
</b:modal> 

をJavaScriptの

function exportChart() { 
    $('#resultado\\:output').empty().append(PF('chart').exportAsImage()); 
} 

私はスクロールを使って短い画像または元のサイズの画像を希望します。

ありがとうございます!

+0

を使用しているかもしれない、モーダルではなく、スクロールの事を示すために、いくつかのオーバーフローのCSSを持っていますか?画像はモダールの正しい場所にありますか? – Kukeltje

答えて

0

私はあなたがこの方法を試すことができると思います。

<p:commandButton value="Modal" type="button" onclick="PF('dlg2').show();" /> 

<p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" height="100"> 

    here goes what you want to show in the modal 

</p:dialog> 

これはprimefaces

+0

uhmmmそれはOPがやっていることです。 outputPanelはダイアログにあります。そして、OPはチャートからそのイメージ(エクスポートされたイメージ)を添付したい、つまりjQueryの処理をしています。 – Kukeltje

関連する問題