문제

I have a custom dialog component using Primefaces:

myDialog.xhtml

<!-- INTERFACE -->
<cc:interface>

    <cc:attribute name="header" />
    <cc:attribute name="id" />

</cc:interface>

<!-- IMPLEMENTATION -->
<cc:implementation>

    <p:dialog  header="#{cc.attrs.header}"
        id="#{cc.attrs.id}" >


    </p:dialog>


</cc:implementation>

and I would like to insert another components inside myDialog, but it doesn't work.

example.xhtml

<puc:myDialog  header="Hi" id="myDialogId">
        **This code doesn't appear. Why?**  
        <p:dataGrid>
            <p:row>
                <p:column>
                <p:inputText></p:inputText>
                </p:column>
                </p:row>
        </p:dataGrid>

</puc:myDialog>
도움이 되었습니까?

해결책

You are missing the cc:insertChildren tag.

<cc:implementation>
 <p:dialog  header="#{cc.attrs.header}" id="#{cc.attrs.id}" >
  <cc:insertChildren />
 </p:dialog>
</cc:implementation>

Any child components or template text within the composite component tag in the using page will be reparented into the composite component at the point indicated by this tag’s placement within the composite:implementation section.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top