简体   繁体   English

如何获得组件rich:modalPanel的所有可用Java脚本方法?

[英]How is it possible to get all available java script methods of the component rich:modalPanel?

I have this rich:modalPanel in my xhtml page: 我的xhtml页面中有以下rich:modalPanel:

<rich:modalPanel id="submitPanel" width="100" height="100"
    style="text-align:center;margin-top:30px;">
    <h:graphicImage value="/img/ajax-loader.gif" style="border: 0;"
            height="30" width="30" />
</rich:modalPanel>

Now i can call it in the onclick js attribute of the component h:commandLink for example: 现在,我可以在组件h:commandLink的onclick js属性中调用它,例如:

<h:commandLink styleClass="dontsave left" value="#{txt.cancel}"
        action="#{newMessageBean.cancelAction}"
        onclick="#{rich:component('submitPanel')}.show(); return true;" />

But how can i get all available js methods of the component rich:modalPanel? 但是,如何获取组件rich:modalPanel的所有可用js方法? The JBoss Documentation is not a good way, so it can be possible that i use an older richfaces version, which is not documented in a suitable way. JBoss文档不是一个好方法,因此我有可能使用较旧的richfaces版本,但没有以适当的方式对其进行记录。

How call i inspect these objects with all available methods on runtime? 我该如何调用运行时所有可用方法来检查这些对象? For example by using Firebug and the command "console.log(#{rich:component('submitPanel')})" or something else? 例如通过使用Firebug和命令“ console.log(#{rich:component('submitPanel')})”)或其他东西? What is the best way of solution? 最好的解决方法是什么?

You can call show modal panel like this: 您可以像这样调用显示模式面板:

<a4j:commandButton styleClass="button" value="#{msg.addNote}"
    oncomplete="Richfaces.showModalPanel('noteDetails')">
</a4j:commandButton>

<rich:modalPanel id="noteDetails" />
    <f:facet name="controls">
        <h:graphicImage value="/images/close.png" 
            style="cursor:pointer" onclick="Richfaces.hideModalPanel('noteDetails')" />
    </f:facet>
</rich:modalPanel>

Here is version with onclick : 这是onclick版本:

<a4j:commandButton value="Find Segments" immediate="true"
    ajaxSingle="true"
    oncomplete="Richfaces.showModalPanel('clientCatSearch')"
    event="onclick" reRender="clientCatSearch">
</a4j:commandButton>

You need to know the full id of the component, eg j_id352:panel . 您需要知道组件的完整ID,例如j_id352:panel Then you can access the component with $('j_id352:panel').component . 然后,您可以使用$('j_id352:panel').component来访问$('j_id352:panel').component

You can't use #{rich:component('submitPanel')} because the #{…} only works for server-side processing, before the page is rendered. 您不能使用#{rich:component('submitPanel')}因为#{…}仅在呈现页面之前用于服务器端处理。

You should consider updating though, at least to RF 3.3.3 if you can't go to RF 4. 不过,如果您不能转到RF 4,则应考虑至少进行RF 3.3.3的更新。

You can inspect ModalPanel.prototype object in Firebug. 您可以在Firebug中检查ModalPanel.prototype对象。

A quick JavaScript snippet to output all members of ModalPanel.prototype : 一个快速的JavaScript代码段,用于输出ModalPanel.prototype所有成员:

var result = '';
for (var item in ModalPanel.prototype) {
   result += item + '\n';
}
alert(result);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取 web 组件上可用的所有公共方法 - How do I get all the public methods available on a web component 无法使用#{rich:component(Id)}或RichFaces访问java脚本中的丰富组件。$(Id) - cannot access rich components in java script using #{rich:component(Id)} or RichFaces.$(Id) 中的简单文本框验证 <rich:modalPanel> 使用JavaScript - simple textbox validation in <rich:modalPanel> using JavaScript 如何使用 google Apps 脚本获取 json 阵列上可用的所有列表 - How to get all lists available on a json Array with google Apps script 如何在Java脚本中获取最大可用屏幕高度? - How to get the maximum available screen height in java script? 使用rich:dataScroller时如何使用javascript获取所有rich:dataTable值? - How to get all rich:dataTable values using javascript when rich:dataScroller is used? 通过js在rich:modalPanel中设置top和left属性 - Set top and left attribute in rich:modalPanel via js 如何在modalPanel中访问传递的参数 - How to access passed parameter in modalPanel 获取<button>组件 html</button>中所有可用<button>元素的</button>列表 - Get list of all available <button> elements in component html 如何使jQuery插件中的设置(或选项)可用于所有方法? - How to make settings (or options) in jQuery plugin available for all methods?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM