Pregunta

I'm attempting to use a t:radio in my rich:datatable but it's always complaining about the fact that it can't find the component. I did some googling and I have to declare the full name, but I actually think I'm doing that.

Anyone can point me what I'm doing wrong? The code (I'm not going to give a minified version because I'm guessing it's going wrong with the compositions):

letterDetailTemplate.xhtml:

<h:form id="generateLetterForm">
    <ui:include src="addStandardLetterMain.xhtml" />
    <ui:include src="addStandardLetterText.xhtml" />
    <ui:include src="buttons.xhtml" />
</h:form>

addStandardLetterText.xhtml (the radio button is over here, in the slrDataTable):

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:e="http://minfin.regondes2/entity"
    xmlns:ccffdecorate="http://java.sun.com/jsf/composite/ccffdecorate"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:l="http://minfin.regondes2/layout"
    xmlns:o="http://omnifaces.org/ui"
    xmlns:t="http://myfaces.apache.org/tomahawk">

    <ui:param name="entityBB" value="#{letterBB}" />
    <ui:param name="type" value="Dossier.Letter" />

<l:screenzone id="addStandardLetterTextPanel"
    title="#{AppMessages[type.concat('.addStandardLetterText.title')]}">

    <h:outputStylesheet name="letterText.css" library="stylesheets" />
    <h:outputScript name="letter.js" library="scripts" />

    <a4j:region>
        <a4j:outputPanel id="letterTextPanel">
            <h:inputTextarea id="letterText" name="letterText"
                value="#{entityBB.entity.text}" styleClass="letterText" />
            <script type="text/javascript">
                    language: '#{screen.locale.language}'
                CKEDITOR.replace( 'generateLetterForm:letterTex', {
                });
            </script>
        </a4j:outputPanel>

        <h:panelGroup styleClass="rButtonPanelAlignLeft" layout="block"
            rendered="#{dossierContextBB.dossierContext == 'EDIT'}">

            <a4j:commandButton
                value="#{AppMessages[type.concat('.add.region')]}"
                actionListener="#{entityBB.findAvailableRegionStandardLetters()}"
                render="slrPopupFormPanel" limitRender="true" status="ajaxStatus"
                onclick="LETTER.CKUpdate()"
                oncomplete="#{rich:component('addStandardLetterRegion')}.show();" />
        </h:panelGroup>

    </a4j:region>


    <rich:popupPanel id="addStandardLetterRegion" modal="true"
        onmaskclick="#{rich:component('addStandardLetterRegion')}.hide()"
        autosized="true">
        <f:facet name="header">
            <h:outputText
                value="#{AppMessages['Dossier.Letter.StandardLetter.region.popup.title']}" />
                </f:facet>
        <f:facet name="controls">
            <h:outputLink value="#"
                onclick="#{rich:component('addStandardLetterCentrum')}.hide(); return false;">
            X
        </h:outputLink>
        </f:facet>
        <a4j:outputPanel id="slrPopupFormPanel">
            <t:selectOneRadio id="slrOption"
                value="#{standardLetterBB.selected}" layout="spread"
                converter="#{standardLetterBB.converter}">
                <f:selectItems value="#{entityBB.availableStandardLetterText}"
                    var="standardLetter" itemLabel="" itemValue="#{standardLetter}" />
            </t:selectOneRadio>
            <rich:dataTable id="slrDataTable"
                value="#{entityBB.availableStandardLetterText}"
                var="standardLetter" noDataLabel="No standard letters found"
                rowKeyVar="index">
                <rich:column headerClass="ListTitle">
                    <t:radio for="generateLetterForm:slrDataTable:slrOption" index="#{index}" />
                </rich:column>

                <e:column entity="#{standardLetter.dossierType}" type="#{type}"
                    property="type" />
                <e:column entity="#{standardLetter}" type="#{type}"
                    property="numbering" />
                <e:columnTranslatable entity="#{standardLetter}" type="#{type}"
                    property="text" />
            </rich:dataTable>
        </a4j:outputPanel>
        <div class="rButtonPanel">
            <h:commandButton value="#{AppMessages['general.action.add']}">
                <a4j:ajax event="click" execute="generateLetterForm"
                    listener="#{entityBB.addMotivationToReport}"
                    oncomplete="#{rich:component('addStandardLetterRegion')}.hide()"
                    render="reportMotivationTextPanel" limitRender="true" />
            </h:commandButton>
            <a4j:commandButton value="#{AppMessages['general.action.cancel']}"
                onclick="#{rich:component('addStandardLetterRegion')}.hide()"
                limitRender="true" immediate="true" bypassUpdates="true" />
        </div>
    </rich:popupPanel>
</l:screenzone>

Note that this view works and renders and displays the data from the backingbean when I remove the t:radio.

The errormessage I'm getting is:

SEVERE: java.lang.IllegalStateException: Could not find component 'generateLetterForm:slrDataTable:slrOption' (calling findComponent on component 'generateLetterForm:slrDataTable:0:j_idt258')
javax.faces.FacesException: java.lang.IllegalStateException: Could not find component 'generateLetterForm:slrDataTable:slrOption' (calling findComponent on component 'generateLetterForm:slrDataTable:0:j_idt258')
¿Fue útil?

Solución

Change for="generateLetterForm:slrDataTable:slrOption" to for=":generateLetterForm:slrOption" and specify id for your t:radio in datatable also. Don't forget the ":" before generateLetterForm.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top