1

我需要更改门户中太慢的例程。这是我的.xhtml文件:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jstl/core">
    <ui:composition>
    <a4j:outputPanel id="pending">
        <rich:panel

        style="border:none;background:transparent; width:100%; height:100%; padding:0px; margin:0px;"
        rendered="#{dataTableBean.noItemFound}" id="noItemFoundPanel">
        <ui:include src="/templates/message/noItemFound.xhtml" />
    </rich:panel>

    <rich:panel
        style="border:none;background:transparent; width:100%; height:100%; padding:0px; margin:0px;"
        rendered="#{detectTreeSelectedNode.hasNoSelectedNode}" id="noItemSelectedPanel">
        <ui:include src="/templates/message/noItemSelected.xhtml" />
    </rich:panel>

    <rich:panel
        style="border:none;background:transparent; width:100%; height:50%; padding:0px; margin:0px;position:absolute;overflow:auto;"
        panelTable>
    </rich:panel>

    <a4j:outputPanel ajaxRendered="true" layout="block"
        style="border:none;background:transparent; position:absolute; bottom:0px; left:0px; right:0px; height:50%; overflow:auto;"
        id="panelDetail">
            <div id="panelDetailContents" style="width:100%; height:100%;"><f:verbatim>#{htmlContentService.content}</f:verbatim></div>
        </a4j:outputPanel>
    </a4j:outputPanel>
</ui:composition>
</html>

id 为的面板,在 Java 代码处panelTable接收一个org.richfaces.component.html.HtmlDataTable,这样:

public void updatePanelTable() {

    detectTreeSelectedNode.setHasNoSelectedNode(false);
    //mount the dynamic datatable
    HtmlDataTable dataTable = getHtmlDatatable();
    SelectedDocuments.clear();

    HTMLContentService service = SessionUtils.findBean("htmlContentService");
    service.updateContent(null);

    UIComponent panel = (UIComponent) FacesContext.getCurrentInstance().getViewRoot()
            .findComponent("principal:panelTable");

    panel.getChildren().clear();
    panel.getChildren().add(dataTable);

    panel = (UIComponent) FacesContext.getCurrentInstance().getViewRoot().findComponent("principal:panelDetail");
    panel.getChildren().clear();        
}

实际上,每个单元格都有一个侦听器HtmlDataTable,在我看来是错误的方式,我想获得事件行选择,没有侦听器并调用处理行选择的方法,我该怎么做才能进入.xhtml面板的孩子并得到他的事件?

pom.xml供参考:

<dependency>
 <groupId>javax.faces</groupId>
 <artifactId>jsf-api</artifactId>
 <version>1.2_12</version>
 <scope>provided</scope>
</dependency>
<dependency>
 <groupId>javax.faces</groupId>
 <artifactId>jsf-impl</artifactId>
 <version>1.2_12</version>
 <scope>provided</scope>
</dependency>
<dependency>
 <groupId>com.sun.facelets</groupId>
 <artifactId>jsf-facelets</artifactId>
 <version>1.1.14</version>
 <scope>compile</scope>
</dependency>
<dependency>
 <groupId>org.richfaces.framework</groupId>
 <artifactId>richfaces-impl</artifactId>
 <version>3.3.1.GA</version>
</dependency>
<dependency>
 <groupId>org.richfaces.framework</groupId>
 <artifactId>richfaces-api</artifactId>
 <version>3.3.1.GA</version>
</dependency>
<dependency>
 <groupId>org.richfaces.ui</groupId>
 <artifactId>richfaces-ui</artifactId>
 <version>3.3.1.GA</version>
</dependency>

提前致谢。

4

1 回答 1

0

首先,我会删除那些内联样式。

其次,您可以使用标记来呈现表格(单击“查看源代码”)。使用它,您应该能够轻松地将侦听器添加到行而不是单元格或您想要的任何内容。

希望能帮助到你。

于 2013-04-15T14:25:48.337 回答