I'm nesting a datable in tabview. On the first page its all working correctly and i can edit the table, but after i switch the tabs, the datatable isnt editable anymore.
Is there something i'm doing wrong?
Using Primefaces 5.3
<h:form id="form">
<p:tabView id="tabs" value="#{studentsTableView.exams}" activeIndex="#{studentsTableView.activTab}" dynamic="true" var="exam" binding="#{tabView}" cache="false" >
<p:ajax event="tabChange" update="form:tabs" />
<p:tab id="tab" title="#{exam.name}">
<p:dataTable id="students" rowIndexVar="rowIndex" var="student" editable="true" widgetVar="gradetable" editMode="cell" tableStyle="width:auto" styleClass="myTable" value="#{studentsTableView.students}">
<p:ajax event="cellEdit" update="students" />
<p:column headerText="Nr">
<h:outputText value="#{rowIndex+1}" />
</p:column>
<p:column headerText="Vorname">
<h:outputText value="#{student.vorname}" />
</p:column>
<p:column headerText="Nachname">
<h:outputText value="#{student.nachname}" />
</p:column>
<p:column headerText="Matrikelnummer">
<h:outputText value="#{student.matrikelnummer}" />
</p:column>
<p:columns value="#{exam.allExams}" var="subexam" columnIndexVar="colIndex">
<f:facet name="header">
<h:outputText value="#{subexam.examName}" />
</f:facet>
<p:cellEditor>
<f:facet name="output"><h:outputText id="modeloutput" value="#{studentsTableView.getGrade(subexam, student)}" /></f:facet>
<f:facet name="input"><p:inputText id="modelInput" value="#{studentsTableView.currentGrade}" valueChangeListener="#{studentsTableView.insertGrade(subexam, student)}" style="width:90%">
<p:ajax event="change" update="modelInput" />
<p:ajax event="change" update="modeloutput" />
<p:ajax event="change" update="modeloutput" />
<p:ajax event="change" update=":form:tabs:0:students" />
</p:inputText></f:facet>
</p:cellEditor>
</p:columns>
<p:column id="endgrades" headerText="Endnote">
<h:outputText id="endgrade" value="#{studentsTableView.getEndGrade(exam, student)}" />
</p:column>
<p:column headerText="Formel">
<p:selectBooleanButton id="value1" value="true" onLabel="Yes" offLabel="No" style="width:60px" />
</p:column>
<p:column headerText="Kommentar">
<p:commandButton id="public" icon="ui-icon-comment" type="button" >
<p:ajax event="click" listener="#{studentsTableView.setPublicCommentInfos(exam, student)}" update="publicarea" />
</p:commandButton>
<p:overlayPanel id="imagePanel" for="public" hideEffect="fade">
<h:inputTextarea id="publicarea" value="#{studentsTableView.publicComment}" >
<p:ajax event="change" update="publicarea" />
</h:inputTextarea>
</p:overlayPanel>
<p:commandButton id="private" icon="ui-icon-locked" type="button" >
<p:ajax event="click" listener="#{studentsTableView.setPrivateCommentInfos(exam, student)}" update="privatearea" />
</p:commandButton>
<p:overlayPanel id="privatepanel" for="private" hideEffect="fade">
<h:inputTextarea id="privatearea" value="#{studentsTableView.privateComment}" >
<p:ajax event="change" update="privatearea" />
</h:inputTextarea>
</p:overlayPanel>
</p:column>
</p:dataTable>
</p:tab>
</p:tabView>
</h:form>
Your problem could be because you're still referencing the datatable id from the first tab, even though you switched to another. You could try to create a different id for each datatable from each tab and then working with those ids and updating them.
Related
I saw this problem here many times but it doesn't help me.
I have the first dataTable with id:servers and I can do right click over a row and a contextMenu appears. I can click in Show Process and I get a second dataTable with id:processes.
But here is the problem, instead of showing the new dataTable I get,
javax.faces.FacesException: DataModel must implement
org.primefaces.model.SelectableDataModel when selection is enabled or
you need to define rowKey attribute
But I have defined rowKey in both dataTable
I have this code:
<h:form id="form" onkeypress="return event.keyCode != 13">
<!-- <p:messages id="msgs" /> -->
<p:growl id="msgs" showDetail="true" sticky="true" autoUpdate="true" />
<!-- Context menu for servers table. -->
<p:contextMenu for="servers">
<p:menuitem value="Show processes" update="form" icon="ui-icon-search" actionListener="#{homeBean.findLSRunningProcesses}" styleClass="homeIE"/>
</p:contextMenu>
<!-- Context menu for processes table. -->
<p:contextMenu for="processes">
<p:menuitem styleClass="homeIE" update="#form" value="Stop Process" icon="ui-icon-stop" oncomplete="stopDialog.show()"/>
</p:contextMenu>
<!-- Servers table. -->
<p:dataTable id="servers" var="server" value="#{homeBean.serverList}" paginator="true" rows="10"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15" widgetVar="serversTable" rowKey="#{server.adminFQDN}"
selection="#{homeBean.selectedLogicalServer}" selectionMode="single" emptyMessage="No servers found with given criteria">
<f:facet name="header">
<h:outputText value="Servers" />
</f:facet>
<p:column filterBy="#{server.ASSETID}" filterMatchMode="contains" sortBy="#{server.ASSETID}" headerText="ASSETID">
<h:outputText value="#{server.ASSETID}" />
</p:column>
<p:column filterBy="#{server.adminFQDN}" filterStyle="width:240px;" filterMatchMode="contains" sortBy="#{server.adminFQDN}" headerText="FQDN">
<h:outputText value="#{server.adminFQDN}" />
</p:column>
<p:column filterBy="#{server.adminIP}" filterMatchMode="contains" sortBy="#{server.adminIP}" headerText="Admin IP">
<h:outputText value="#{server.adminIP}" />
</p:column>
<p:column filterBy="#{server.delivery}" filterMatchMode="exact" sortBy="#{server.delivery}" headerText="Delivery">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('serversTable').filter()">
<f:selectItem itemLabel="Select One" itemValue="#{null}" noSelectionOption="false" />
<f:selectItems label="#{homeBean.deliveries}" value="#{homeBean.deliveries}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{server.delivery}" />
</p:column>
<p:column filterBy="#{server.environment}" filterMatchMode="exact" sortBy="#{server.environment}" headerText="Environment">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('serversTable').filter()">
<f:selectItem itemLabel="Select One" noSelectionOption="true" itemValue="#{null}"/>
<f:selectItems value="#{homeBean.environments}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{server.environment}" />
</p:column>
<p:column filterBy="#{server.function}" filterMatchMode="exact" sortBy="#{server.function}" headerText="Function">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('serversTable').filter()">
<f:selectItem itemLabel="Select One" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{homeBean.functions}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{server.function}" />
</p:column>
<p:column filterBy="#{server.osVersion}" filterMatchMode="contains" sortBy="#{server.osVersion}" headerText="OS VERSION">
<h:outputText value="#{server.osVersion}" />
</p:column>
<p:column filterBy="#{server.os}" filterMatchMode="contains" sortBy="#{server.os}" headerText="OS">
<h:outputText value="#{server.os}" />
</p:column>
</p:dataTable>
<!-- Panel containing processes tables. -->
<p:panelGrid id="serverProcesses" styleClass="group-user-selection-table" rendered="#{homeBean.showSelectionPanel}">
<f:facet name="header">
<p:row>
<p:column>
<h:outputText value="#{homeBean.selectedLogicalServer.adminFQDN}" />
</p:column>
</p:row>
</f:facet>
<p:row>
<!--Processes table. -->
<p:column>
<p:dataTable id="processes" var="process" value="#{homeBean.processesList}" filteredValue="#{homeBean.filteredProcesses}"
selection="#{homeBean.selectedProcesses}" paginator="true" rows="15" rowKey="#{process.owner}"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="15,20,25,30" selectionMode="single" emptyMessage="No processses found with given criteria">
<f:facet name="header">
<h:outputText value="Processes" />
</f:facet>
<p:column name="owner" filterBy="#{process.owner}" filterMatchMode="contains" sortBy="#{process.owner}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'DESCRIPTION' : 'OWNER'}">
<h:outputText value="#{process.owner}" />
</p:column>
<p:column name="pid" filterBy="#{process.pid}" filterMatchMode="exact" sortBy="#{process.owner}" headerText="PID">
<h:outputText value="#{process.pid}" />
</p:column>
<p:column name="ppid" filterBy="#{process.ppid}" filterMatchMode="exact" sortBy="#{process.ppid}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'TYPE' : 'PPID'}">
<h:outputText value="#{process.ppid}" />
</p:column>
<p:column name="c" filterBy="#{process.c}" filterMatchMode="exact" sortBy="#{process.c}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'STATE' : 'C'}">
<h:outputText value="#{process.c}" />
</p:column>
<p:column name="stime" filterBy="#{process.stime}" filterMatchMode="contains" sortBy="#{process.stime}" headerText="STIME" rendered="#{!(homeBean.selectedLogicalServer.os eq 'Windows')}">
<h:outputText value="#{process.stime}" />
</p:column>
<p:column name="tty" filterBy="#{process.tty}" filterMatchMode="contains" sortBy="#{process.tty}" headerText="TTY" rendered="#{!(homeBean.selectedLogicalServer.os eq 'Windows')}">
<h:outputText value="#{process.tty}" />
</p:column>
<p:column name="time" filterBy="#{process.time}" filterMatchMode="contains" sortBy="#{process.time}" headerText="TIME" rendered="#{!(homeBean.selectedLogicalServer.os eq 'Windows')}">
<h:outputText value="#{process.time}" />
</p:column>
<p:column name="cmd" filterBy="#{process.cmd}" filterMatchMode="contains" sortBy="#{process.cmd}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'NAME' : 'CMD'}">
<h:outputText value="#{process.cmd}" />
</p:column>
</p:dataTable>
</p:column>
</p:row>
</p:panelGrid>
<p:dialog header="Stop Process" widgetVar="stopDialog" minHeight="40" styleClass="dialogPosition">
<h:outputText value="You are going to stop the process "/>
<h:outputText value="#{homeBean.selectedProcesses.cmd}"/>
<h:outputText value="with PID"/>
<h:outputText value="#{homeBean.selectedProcesses.pid}"/>
<br /><br /><br /><br />
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" style="float:left" onclick="stopDialog2.show();stopDialog.hide();" actionListener="#{homeBean.attrListener}">
<f:attribute name="processPID" value="#{process.pid}" />
</p:commandButton>
<p:commandButton value="NO" onclick="stopDialog.hide()" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" style="float:right"/>
</p:dialog>
<p:dialog header="Stop Process" widgetVar="stopDialog2" minHeight="40" styleClass="dialogPosition">
<h:outputText value="You are going to send an email to:"/>
<br />
<h:outputText value="#{homeBean.email}"/>
<br /><br /><br />
<p:commandLink value="Yes" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" style="float:left" update="form" action="#{homeBean.stopProcess}" oncomplete="stopDialog2.hide();"/>
<p:commandButton value="NO" onclick="stopDialog2.hide()" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" style="float:right"/>
</p:dialog>
</h:form>
FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled
this solution works to me.
Especially this answer https://stackoverflow.com/a/10527008/5250930
The table must implement the SelectableDataModel
I am trying to use datatable selection in dialog widget. But I cannot get selected value in my bean. Datatable selection is working, if I delete dialog widget tag. I am using PrimeFaces 4.0. How can I fix this?
passengerform.xhtml
<p:hotkey bind="esc" handler="dialogWidget.hide();" />
<p:dialog id="dialog" widgetVar="dialogWidget"
header="Coupon List" modal="true" width="400" showEffect="fade"
hideEffect="fade" appendTo="#(body)">
<h:form id="formDialog">
<h:outputLabel value="Lütfen E-ticket Kuponunu Seçiniz." />
<p:dataTable id="singleDT" var="coupon"
value="#{passengerFormService.couponList}"
rowKey="#{coupon.id}" rowIndexVar="rowIndex"
selection="#{passengerFormService.selectedCoupon}"
selectionMode="single">
<p:ajax event="rowSelect"
listener="#{passengerFormService.selectCoupon}"
update=":tab1:tab1_1:eticketform:formDialog">
<f:setPropertyActionListener value="#{coupon}"
target="#{passengerFormService.coupon}" />
</p:ajax>
<f:facet name="header"></f:facet>
<h:inputHidden name="hidden1"
value="#{passengerFormService.passengerForm.id}" />
<p:column style="width:20px" width="20">
<f:facet name="header">
<h:outputText value="#" />
</f:facet>
<h:outputText value="#{rowIndex+1}" />
</p:column>
<p:column headerText="Id">
<h:outputText value="#{coupon.id}" />
</p:column>
<p:column headerText="Departure Location">
<h:outputText value="#{coupon.departureLocation}" />
</p:column>
<f:facet name="footer"></f:facet>
</p:dataTable>
<p:separator />
<h:panelGrid columns="2" cellspacing="5"
columnClasses="alignLeft,alignRight" style="width:100%">
<p:commandButton id="selectButton1" update=""
icon="ui-icon-close" value="İptal"
oncomplete="PF('dialogWidget').hide()" />
<p:commandButton id="cancelSelectedButton1"
update=":tab1:tab1_1:passengerInsertform"
icon="ui-icon-check"
value="Onayla" oncomplete="PF('dialogWidget').hide()" />
</h:panelGrid>
</h:form>
</p:dialog>
PassengerFormService.java
public void selectCoupon(SelectEvent event) {
Log.getLogger().debug("New2 coupon selected...");
Log.getLogger().debug("selected: " +getSelectedCoupon());
}
I have the following structure in my application:
<h:outputLabel value="Regiões :" />
<p:autoComplete multiple="true" value="#{investimento.regioesSelecionadas}"
completeMethod="#{investimento.completaRegiao}"
var="reg" itemLabel="#{reg.label}" itemValue="#{reg}"
converter="entityConverter" forceSelection="true">
<p:column>
<h:outputText value="#{reg.label}" />
</p:column>
<p:ajax event="itemSelect" update="regiaoCol" />
<p:ajax event="itemUnselect" update="regiaoCol" />
<p:ajax event="itemUnselect" listener="#{investimento.tiraUmaRegiao}"/>
</p:autoComplete>
<h:outputText />
<h:panelGroup id="regiaoCol">
<c:forEach items="#{investimento.regioesSelecionadas}" var="regSel" rendered="#{!investimento.regioesSelecionadas.isEmpty()}">
<h:panelGrid columns="2">
<h:outputLabel value="Região #{regSel.label} - Estados:" />
<p:autoComplete multiple="true" value="#{investimento.estadosSelecionados}"
var="est" itemLabel="#{est.label}" itemValue="#{est}"
completeMethod="#{investimento.completaEstado}"
converter="entityConverter" forceSelection="true" cash="true">
<f:attribute name="regPar" value="#{regSel}" />
<p:column>
<h:outputText value="#{est.label}" />
</p:column>
<p:ajax event="itemSelect" update="#{investimento.idComposta(est, regSel)}" />
<p:ajax event="itemUnselect" update="regiaoCol" />
<p:ajax event="itemUnselect" update="#{investimento.idComposta(est, regSel)}"/>
<p:ajax event="itemUnselect" update="#{investimento.idComposta(est, regSel)}" listener="#{investimento.tiraUmEstado}"/>
</p:autoComplete>
<h:outputLabel />
<h:panelGroup id="#{investimento.idComposta(est, regSel)}">
<c:forEach items="#{investimento.estadosSelecionados}" var="estSel">
<h:panelGrid columns="2">
<h:outputLabel value="Estado #{estSel.label} - Municipios: #{investimento.idComposta(est, regSel)}" />
<p:autoComplete multiple="true" value="#{investimento.municipiosSelecionados}"
var="mun" itemLabel="#{mun.label}" itemValue="#{mun}"
completeMethod="#{investimento.completaMunicipio}" maxResults="8"
converter="entityConverter" forceSelection="true" cash="true">
<f:attribute name="estPar" value="#{estSel}" />
<p:column>
<h:outputText value="#{mun.label}" />
</p:column>
</p:autoComplete>
</h:panelGrid>
</c:forEach>
</h:panelGroup>
</h:panelGrid>
</c:forEach>
</h:panelGroup>
So, whenever I pick a "Região" will apear in "regiaoCol" new options for the user to select. However there's an issue: when I remove a "Região", add it again and try to remove it once more, it causes the following error:
> Grave: Error Rendering View[/InsI.xhtml]
javax.faces.FacesException: Cannot find component with expression "munEst2Reg3" referenced from "form:j_idt190".
at org.primefaces.expression.SearchExpressionFacade.resolveComponentInternal(SearchExpressionFacade.java:422)
at org.primefaces.expression.SearchExpressionFacade.resolveComponentForClient(SearchExpressionFacade.java:200)
at org.primefaces.expression.SearchExpressionFacade.resolveComponentsForClient(SearchExpressionFacade.java:147)
at org.primefaces.util.AjaxRequestBuilder.addExpressions(AjaxRequestBuilder.java:92)
at org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:85)
at org.primefaces.behavior.ajax.AjaxBehaviorRenderer.getScript(AjaxBehaviorRenderer.java:80)
at javax.faces.component.behavior.ClientBehaviorBase.getScript(ClientBehaviorBase.java:103)
at org.primefaces.renderkit.CoreRenderer.encodeClientBehaviors(CoreRenderer.java:458)
Which, I presume, is caused by the browser looking for that reference, in this case "munEst2Reg3" and it not being there. However: why it throws the error? How is it different from removing the "Região" the first time? How to I solve the issue? Should I submit the page after each unselection? (which wouldn't be the most user friendly option)
Tiny's response put me on the right track and, after some debuging I found somethings:
As all the instances are altering the same list is paramount that all of them have a event or one will delete the inputs of the other;
You have also to take care on how the dataTable behaves and guarantee that he only gets the values that you are interested in;
How my code ended up being:
<h:outputLabel value="Regiões :" />
<p:autoComplete multiple="true" value="#{investimento.regioesSelecionadas}"
completeMethod="#{investimento.completaRegiao}"
var="reg" itemLabel="#{reg.label}" itemValue="#{reg}"
converter="entityConverter" forceSelection="true">
<p:column>
<h:outputText value="#{reg.label}" />
</p:column>
<p:ajax event="itemSelect" update="regiaoCol" />
<p:ajax event="itemUnselect" update="regiaoCol" listener="#{investimento.tiraUmaRegiao}"/>
</p:autoComplete>
<h:outputText />
<h:panelGroup id="regiaoCol">
<p:dataTable value="#{investimento.regioesSelecionadas}" var="regSel" rendered="#{investimento.regioesSelecionadas.isEmpty() == false}">
<p:column>
<h:outputLabel value="Região #{regSel.label} - Estados:" />
</p:column>
<p:column>
<p:autoComplete multiple="true" value="#{investimento.estadosSelecionados}"
var="est" itemLabel="#{est.label}" itemValue="#{est}"
completeMethod="#{investimento.completaEstado}"
converter="entityConverter" forceSelection="true">
<f:attribute name="regPar" value="#{regSel}" />
<p:column>
<h:outputText value="#{est.label}" />
</p:column>
<p:ajax event="itemSelect" update="#{investimento.idComposta()}" >
<f:attribute name="regiaoPar" value="#{regSel}" />
</p:ajax>
<p:ajax event="itemUnselect" update="#{investimento.idComposta()}" listener="#{investimento.tiraUmEstado}">
<f:attribute name="regiaoPar" value="#{regSel}" />
</p:ajax>
</p:autoComplete>
</p:column>
<p:column>
<h:panelGroup id="#{investimento.idComposta()}">
<f:attribute name="regiaoPar" value="#{regSel}" />
<p:dataTable value="#{investimento.meusEstSel()}" var="estSel" rendered="#{investimento.meusEstSel().isEmpty() == false}">
<f:attribute name="regiaoPar" value="#{regSel}" />
<p:column>
<h:outputLabel value="Estado #{estSel.label} - Municipios:" />
</p:column>
<p:column>
<p:autoComplete multiple="true" value="#{investimento.municipiosSelecionados}"
var="mun" itemLabel="#{mun.label}" itemValue="#{mun}"
completeMethod="#{investimento.completaMunicipio}" maxResults="8"
converter="entityConverter" forceSelection="true">
<f:attribute name="estPar" value="#{estSel}" />
<p:column>
<h:outputText value="#{mun.label}" />
</p:column>
<p:ajax event="itemSelect" />
<p:ajax event="itemUnselect" />
</p:autoComplete>
</p:column>
</p:dataTable>
</h:panelGroup>
</p:column>
</p:dataTable>
</h:panelGroup>
I'm trying to include the paginator on my datatable but it's not working, i have the table and the paginator shows but it's not working, always int page 1 !!
this is my code :
![datatable paginator not working ][1]
<h:form id="form">
<p:outputPanel id="users">
<p:dataTable id="usersTable" value="#{personBean.allPersons}" paginator="true" rows="4" var="person" >
<p:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<p:commandLink action="#{personBean.editPerson}">
<h:outputText value="#{person.name}" />
<f:setPropertyActionListener target="#{personBean.person}"
value="#{person}" />
</p:commandLink>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Age" />
</f:facet>
<p:commandLink action="#{personBean.editPerson}">
<h:outputText value="#{person.age}" />
<f:setPropertyActionListener target="#{personBean.person}"
value="#{person}" />
</p:commandLink>
</p:column>
</p:dataTable>
</p:outputPanel>
<p:commandButton value="Create New User"
action="#{personBean.newPerson}" />
</h:form>
always i have the same table, i can't move to 2
I tried to update a Gmap which placed in a tabView. But i am getting the
java.lang.IllegalArgumentException: tab2
error. I have searched this problem a little and noticed that it is available only if tab is visible. So what can I do ? The code block is below:
<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;">
When you reference a component inside container components like tabView or accordion, you don't need to include the actual tab id in your update target.
In your case update=":form:tabView:map2" would be the correct update target.