在primefaces中访问不可见的选项卡

时间:2012-10-19 06:53:41

标签: jsf primefaces

我尝试更新放置在tabView中的Gmap。但我得到了

java.lang.IllegalArgumentException: tab2  

错误。我已经搜索了一下这个问题,并注意到只有当tab可见时它才可用。那我该怎么办?代码块如下:

<h:form id="form">
        <p:tabView orientation="left" id="tabView" styleClass="tabView">

            <p:ajax event="tabChange" listener="#{sucBean.onTabChange}"
                update=":form:tabView:map" />

            <p:tab title="Bütün Suçlar" id="tab1">

                <p:gmap zoom="10" type="HYBRID" center="40.78470,29.94873" id="map"
                    model="#{sucBean.advancedModel}"
                    style="width:740px;height:500px;margin:-14px 0 0 -10px;">

                    <p:ajax event="overlaySelect" listener="#{sucBean.onMarkerSelect}" />

                    <p:gmapInfoWindow>
                        <p:outputPanel
                            style="text-align:justify;display:block;margin:auto:">
                            <p:panelGrid columns="2" cellpadding="8">

                                <h:outputText value="Suç Tipi:" style="color:red" />
                                <h:outputText value="#{sucBean.marker.data.sucTipi}" />

                                <h:outputText value="Tarih: " style="color:red" />
                                <h:outputText value="#{sucBean.marker.data.islenmeZamani}" />

                                <h:outputText value="Adres: " style="color:red" />
                                <h:outputText value="#{sucBean.marker.data.adres}" />

                                <h:outputText value="Suçu İşleyen:" style="color:red" />
                                <h:outputText value="#{sucBean.marker.data.isleyenBilgisi}" />
                            </p:panelGrid>
                        </p:outputPanel>

                    </p:gmapInfoWindow>



                </p:gmap>

            </p:tab>

            <p:tab title="Suç Ara" id="tab2">
                <p:fieldset legend="Ayrıntılı Arama" styleClass="searchField"
                    id="fieldSet">

                    <p:panelGrid columns="4" cellpadding="10">
                        <p:inputText value="#{sucBean.arananKelime}" style="width:300px" />
                        <h:outputText value=" Kriter:" />
                        <p:selectOneMenu value="#{sucBean.aramaKriteri}">
                            <f:selectItem itemLabel="Suç Tipi" itemValue="sucTipi" />
                            <f:selectItem itemLabel="Adres" itemValue="adres" />
                            <f:selectItem itemLabel="İşlenme Zamanı" itemValue="zaman" />
                            <f:selectItem itemLabel="Cinsiyet" itemValue="cinsiyet" />
                            <f:selectItem itemLabel="Yaş" itemValue="yas" />
                        </p:selectOneMenu>

                        <p:commandButton value="Ara"
                            actionListener="#{sucBean.sucKaydiAra}" update="aramaSonucu" />
                    </p:panelGrid>

                </p:fieldset>

                <p:dataTable var="suc" value="#{sucBean.sucModel}" paginator="true"
                    rows="10" id="aramaSonucu" selection="#{sucBean.selectedSuc}">

                    <p:column selectionMode="multiple" style="width:18px"></p:column>

                    <p:column headerText="Suç Tipi">
                        <h:outputText value="#{suc.sucTipi}" />
                    </p:column>

                    <p:column headerText="İşlenme Zamanı">
                        <h:outputText value="#{suc.islenmeZamani}" />
                    </p:column>

                    <p:column headerText="Adres">
                        <h:outputText value="#{suc.adres}" />
                    </p:column>

                    <p:column headerText="Suçu İşleyen">
                        <h:outputText value="#{suc.isleyenBilgisi}" />
                    </p:column>

<!--                        <f:facet name="footer"> -->

<!--                        </f:facet> -->

                </p:dataTable>

                <p:commandButton id="multiSelectButton"  actionListener="#{sucBean.secilenleriGetir}" update=":form:tabView:tab2:map2"
                            value="Secilenleri Haritada Göster" icon="ui-icon-pin-s" />

                <p:gmap zoom="12" type="HYBRID" center="40.78470,29.94873"
                    id="map2" model="#{sucBean.advancedModel2}"
                    style="width:740px;height:300px;margin:10px 0 0 -10px;">

1 个答案:

答案 0 :(得分:0)

当您引用容器组件(如tabView或accordion)中的组件时,您不需要在更新目标中包含实际的选项卡ID。

在您的情况下,update=":form:tabView:map2"将成为正确的更新目标。