【发布时间】:2016-06-11 17:00:49
【问题描述】:
我使用 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());
}
我想要一张短图片或带卷轴的原始尺寸图片。
谢谢!
【问题讨论】:
-
也许模态有一些溢出的css来显示东西而不是滚动?图像在模态中的位置是否正确?
标签: javascript jsf primefaces charts size