سؤال

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