如何在richfaces中使用reRender特定行4

时间:2012-02-24 18:07:43

标签: jsf-2 richfaces

我正在尝试reRender数据表中的子表的特定行。我正在使用在JBoss AS 7.1 CR1b上运行的richfaces 4.2 final和jsf 2。从我能找到的方法来看,有两种方法可以使用@rows()或table:row,但是我无法使用它。我不确定它是否可以用subTable来做,或者怎么做。

生成的源中的单元格的ID如下所示:id="tableForm:timesheetTable:0:subTable:0:j_idt55"

这是我的表格代码:

<h:form id="tableForm" >
    <rich:dataTable var="day" value="#{timesheetHome.days}" id="timesheetTable" rowKeyVar="rowKey">
        <f:facet name="header">
            <rich:columnGroup>
                <rich:column>
                    <h:outputText value="Ticket Nbr" />
                </rich:column>
                <rich:column>
                    <h:outputText value="Assigned By" />
                </rich:column>
                <rich:column style="width:60px;">
                    <h:outputText value="Status" />
                </rich:column>
                <rich:column>
                    <h:outputText value="Hours"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="Description" />
                </rich:column>
                <rich:column>
                    <h:outputText value="Details"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="Non-Billable"/>
                </rich:column>
                <rich:column>
                </rich:column>
                <rich:column>
                </rich:column>
                <rich:column>
                </rich:column>
            </rich:columnGroup>
        </f:facet>

        <rich:column colspan="10" style="background-color:#eee;">
            <h:outputText value="#{day.name}"/>
        </rich:column>


        <rich:collapsibleSubTable var="item" value="#{day.items}" rowKeyVar="rowNum" id="subTable">
            <rich:column>
                <h:outputText value="#{item.ticketNumber}" />
            </rich:column>
            <rich:column>
                <h:outputText value="#{item.reportTo}" />
            </rich:column>
            <rich:column>
                <h:outputText value="#{item.status}"/>
            </rich:column>
            <rich:column>
                <h:outputText value="#{item.hours}" />
            </rich:column>
            <rich:column>
                <h:outputText value="#{item.task}" />
            </rich:column>
            <rich:column>
                <h:outputText value="#{item.notes}" />
            </rich:column>
            <rich:column>
                <h:selectBooleanCheckbox value="#{item.nonBillable}" disabled="true"/>
            </rich:column>
            <rich:column>
                <a:outputPanel>
                    <h:graphicImage value="/resources/img/check.png" onclick="completed(#{item.id});"/>
                    <rich:tooltip showDelay="500" value="Change Status" layout="block" followMouse="false" />
                </a:outputPanel>
            </rich:column>
            <rich:column>
                <a:outputPanel>
                    <h:graphicImage value="/resources/img/edit.png" onclick="edit(#{item.id},#{rowKey},#{rowNum});"/>
                    <rich:tooltip showDelay="500" value="Edit" layout="block" followMouse="false" />
                </a:outputPanel>
            </rich:column>
            <rich:column>
                <a:outputPanel>
                    <h:graphicImage value="/resources/img/delete.png" onclick="remove(#{item.id});"/>
                    <rich:tooltip showDelay="500" value="Delete" layout="block" followMouse="false" />
                </a:outputPanel>
            </rich:column>

        </rich:collapsibleSubTable>


        <f:facet name="footer">
        <rich:columnGroup>
            <rich:column colspan="5">
                <h:outputText value="Total hours: "/>
                <h:outputText value="#{timesheetHome.weekHours}"/>
            </rich:column>
            <rich:column colspan="5">
                <h:outputText value="Billable hours: "/>
                <h:outputText value="#{timesheetHome.weekBillableHours}"/>
            </rich:column>
        </rich:columnGroup>
        </f:facet>
    </rich:dataTable>
    </h:form>

和应该重新修改该行的按钮:

<a:commandButton id="update"
                      value="Update"
                     action="#{timesheetHome.update}" rendered="#{timesheetHome.managed}" render="timesheetTable:#{timesheetHome.rowKey}:subTable:#{timesheetHome.rowNum} notify" oncomplete="if (!#{timesheetHome.error}){#{rich:component('popup')}.hide();}"/>

当rowKey和rowNum是原始类型int时,重新渲染器上没有任何反应。如果我将它们更改为在辅助bean中键入Integer,则会出现以下错误:

 WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--0.0.0.0-8080-5) String index out of range: 0: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:695) [:1.7.0_02]
at org.richfaces.context.IdParser.parse(IdParser.java:120) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.context.ComponentIdResolver.addIdImmediately(ComponentIdResolver.java:196) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.context.ComponentIdResolver.addId(ComponentIdResolver.java:231) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.renderkit.util.CoreRendererUtils.findComponentsFor(CoreRendererUtils.java:137) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.context.RenderComponentCallback.doVisit(RenderComponentCallback.java:86) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.context.ExecuteComponentCallback.doVisit(ExecuteComponentCallback.java:47) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.context.ComponentCallback.visit(ComponentCallback.java:94) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:321) [richfaces-core-impl-4.2.0.Final.jar:]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1589) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIForm.visitTree(UIForm.java:344) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at org.richfaces.context.ExtendedPartialViewContextImpl.visitActivatorComponent(ExtendedPartialViewContextImpl.java:440) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.context.ExtendedPartialViewContextImpl.visitActivatorAtExecute(ExtendedPartialViewContextImpl.java:310) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.context.ExtendedPartialViewContextImpl.getExecuteIds(ExtendedPartialViewContextImpl.java:98) [richfaces-core-impl-4.2.0.Final.jar:]
at org.richfaces.context.ExtendedPartialViewContextImpl.isExecuteAll(ExtendedPartialViewContextImpl.java:148) [richfaces-core-impl-4.2.0.Final.jar:]
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:929) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.7.Final.jar:]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam.jar:]
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [jboss-seam.jar:]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [jboss-seam.jar:]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam.jar:]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam.jar:]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.7.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151) [jboss-as-web-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.7.Final.jar:]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) [jbossweb-7.0.7.Final.jar:]
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) [jbossweb-7.0.7.Final.jar:]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) [jbossweb-7.0.7.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [:1.7.0_02]

0 个答案:

没有答案