从自身更新primefaces复合组件

时间:2014-12-22 08:19:15

标签: jsf primefaces composite-component

我在PrimeFaces 4中创建了一个复合组件。

<composite:interface>
    <composite:attribute name="title" required="true"/>
    <composite:attribute name="widgetVar" required="true" />
    <composite:attribute name="controller" required="true" type="com.controller.AbstractController" />
</composite:interface>
<composite:implementation>
    <div id="#{cc.clientId}" style="width: 100%;">
        <p:dialog widgetVar="#{cc.attrs.widgetVar}" header="#{msgs[cc.attrs.title]}" width="500">
                <p:panelGrid styleClass="borderLessGrid" columns="1" id="mainPanel" style="width:100%;">
                    <p:panel style="width: 100%; text-align: left; direction: ltr;" id="btnPanel">
                        <ui:repeat value="#{cc.attrs.controller.commands}" var="command">
                            <p:commandButton
                                    value="#{command.value}" title="#{command.title}"
                                    style="width: 50px;"
                                    disabled="#{not command.enable}" actionListener="#{command.onClick}"
                                    update="@this"/>
                        </ui:repeat>
                    </p:panel>
                    <p:panel style="width: 100%">
                        <p:scrollPanel mode="native" style="width: 100%; height: 300px; border: none;">
                            <p:tree value="#{cc.attrs.controller.rootNode}" var="node" id="tree"
                                    selectionMode="single"
                                    style="vertical-align:top; float:right; width: 95%; border: none;">
                                <p:ajax event="select"
                                        listener="#{cc.attrs.controller.onTreeItemSelect}"
                                        update="#{cc.clientId}"/>
                                <p:treeNode id="treeNode"
                                            expandedIcon="ui-icon-folder-open"
                                            collapsedIcon="ui-icon-folder-collapsed">
                                    <p:outputLabel value="#{node}" id="lblNode"/>
                                </p:treeNode>
                            </p:tree>
                        </p:scrollPanel>
                    </p:panel>
                    <p:panel style="width: 100%">
                        <p:scrollPanel mode="native" style="width: 100%; height: 100px; border: none;">
                            <p:outputLabel />
                        </p:scrollPanel>
                    </p:panel>
                </p:panelGrid>
        </p:dialog>
    </div>
</composite:implementation>

当用户点击树元素时,我会更新组件的所有部分。但是当我在资源管理器中输入页面URL时,它会给我以下错误:

  

找不到带表达式的组件&#34; conditionCreator&#34;引自&#34; conditionCreator:tree&#34;

你有任何解决方案。
感谢。

更新时间:2014-24-12
我读了this link但它不起作用。我不知道问题在哪里,但当我使用这个解决方案时,它会刷新我的所有页面。

1 个答案:

答案 0 :(得分:0)

行动。它通过jQuery选择器API解决。请访问以下链接了解更多详情:
jQuery Selector API meets JSF