0
我有一个自定义对话框必须显示在多个地方,我想尽量减少代码的乘法。如何将对象传递给jquery函数?
<p:dialog id="basicDialog" dynamic="true" header="Test Page Survey" widgetVar="surveyPanel"
showEffect="slide" hideEffect="drop" visible="false" modal="true" closable="false"
onShow="somecondition()">
<h:form id="surveyForm" styleClass="wizard-panel" enctype="multipart/form-data">
...
...
<div id="saveCancelDiv" class="navigation-panel">
<p:commandButton id="btnCancelSurvey"
value="Cancel"
onclick="someJS.cancelOrderBalloonShowSurvey(); return false;"
type="button"
styleClass="cancel-button"/>
<p:commandButton id="btnContinue"
value="Continue"
style="float:right;"
oncomplete="someJS.handleDialogSubmit(xhr, status, args);"
actionListener="#{xx.save}"
styleClass="continue-button" />
</div>
</h:form>
</p:dialog>
<cp:confirmDialog id="cancel-order-confirm-dialog-survey" umb_key="cancel-order-confirm-dialog-survey" position="right bottom" modal="true" style="z-index: 2000;">
<div id="outputPanel" class="alert-dialog" >
Do you really want to cancel this order?
<br/>
<p:commandButton id="btnCancelOrderYes" value="Yes" onclick="someJS.cancelOrderBalloonYesSurvey(event); return false;" type="button" />
<p:commandButton id="btnCancelOrderNo" value="No" onclick="someJS.cancelOrderBalloonHideSurvey(event); return false;" type="button" />
</div>
</cp:confirmDialog>
cancelOrderBalloonShowSurvey(),cancelOrderBalloonYesSurvey()和cancelOrderBalloonHideSurvey()是应该使用的每一个有人想用这个 定制的确认对话框时JS功能。但事实并非如此。 我想要做的是将'surveyPanel'对话框传递给cancelOrderBalloonYesSurvey(event)。我已经试过这样的事情
cancelOrderBalloonYesSurvey(event, surveyPanel) -> this did not work
cancelOrderBalloonYesSurvey(event, this.surveyPanel) -> this did not work
cancelOrderBalloonYesSurvey(event, this.parent.surveyPanel) -> this did not work
如何传递的指针surveyPanel,使surveyPanel可以cancelOrderBalloonYesSurvey被关闭()?
surveyPanel是什么?我没有看到带有该ID或类的标签。 – jalynn2
它是第一行代码的一部分:widgetVar =“surveyPanel” – user1860447