after so many search I couldn't find a way to update my datatable after a command button clicked in a primeface's dialog.
My mainMenu.xhtml has a datatable like:
<section id="ownermanagement">
<h:form id="ownermanagementform">
<p:commandButton class="btn icon-cart" actionListener="#{ownerControl.viewNewOwnerDialog()}" value="کارفرما جدید"/>
<br></br><br></br>
<p:growl id="growl" showDetail="true"/>
<p:dataTable filterEvent="enter" id="ownerdatatable" value="#{ownerControl.ownerList}" var="owners" dir="rtl" emptyMessage="موردی با این مشخصات یافت نشد." style="border: 1px solid black;">
<p:column filterBy="#{owners.id}" filterMatchMode="contains">
<f:facet name="header">شناسه</f:facet>
#{owners.id}
</p:column>
<p:column filterBy="#{owners.name}" filterMatchMode="contains">
<f:facet name="header">نام</f:facet>
#{owners.name}
</p:column>
<p:column>
<f:facet name="header">عملیات</f:facet>
<p:commandButton value="ویرایش کارفرما"
actionListener="#{ownerControl.viewEditOwnerDialog(owners)}" update="ownerdatatable"/> |
<p:commandButton value="حذف کارفرما"
action="#{ownerControl.removeOwner(owners)}"
onclick="return confirm('آیا از حذف کارفرما اطمینان دارید؟')"
update="ownerdatatable"/>
</p:column>
</p:dataTable>
</h:form>
</section>
I open my dialog like this:
<p:commandButton class="btn icon-cart" actionListener="#{ownerControl.viewNewOwnerDialog()}" value="کارفرما جدید"/>
The viewNewOwnerDialog method is:
public void viewNewOwnerDialog() {
Map<String, Object> options = new HashMap<String, Object>();
//options.put("modal", true);
options.put("resizable", false);
resetInputs();
RequestContext.getCurrentInstance().openDialog("createOwner", options, null);
}
This will open my createOwner page in a dialog:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>کارفرما جدید</title>
<link rel="stylesheet" type="text/css" href="resources/style/elements.css" />
</h:head>
<h:body dir="rtl">
<h:form id="newOwnerForm">
<p:growl id="growl" showDetail="true" sticky="true"/>
نام: <h:inputText class="InputField" value="#{ownerControl.owner.name}"/>
<br></br><br></br>
توضیحات: <p:inputTextarea class="textArea" value="#{ownerControl.owner.description}" rows="5" cols="100" counter="display" maxlength="500" counterTemplate="{0}" autoResize="false" />
<h:outputText id="display" /><br></br>
<p:commandButton class="btn icon-cart" value="ثبت" action="#{ownerControl.insertOwner()}" process="#all" update=":ownermanagementform:ownerdatatable"/>
</h:form>
</h:body>
</html>
How can I update a growl to show a message and after that I update the mainMenu's datatable?
At the moment, I get this error:
Cannot find component with expression ":ownermanagementform:ownerdatatable" referenced from "newOwnerForm:j_idt10".
Thanks!
I solved it like this:
<p:commandButton value="Open Dialog" actionListener"...">
<p:ajax event="dialogReturn" update="datatableID"/>
</p:commandButton>
Related
I have an index.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Project1</title>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:body>
<ui:composition template="template.xhtml">
<ui:define name="content">
<h:form id="mainForm">
<ui:include src="/WEB-INF/includes/offer.xhtml">
</ui:include>
<p:messages/>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
using template.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<ui:insert name="content"/>
</h:body>
</html>
and including /WEB-INF/includes/offer.xhtml
<ui:composition>
<ui:include src="/WEB-INF/dialogs/offerdialog.xhtml">
</ui:include>
<p:commandButton value="Dialog 1 (doesn't repond to mode change)"
onsuccess="PF('myDialogVar1').show();">
</p:commandButton>
<p:commandButton value="Dialog 2 (does respond to mode change)"
onsuccess="PF('myDialogVar').show();">
</p:commandButton>
</ui:composition>
including /WEB-INF/dialogs/offerdialog.xhtml
<ui:composition>
<p:dialog id="myDialog1" widgetVar="myDialogVar1" modal="true">
<h:form>
<h:panelGroup>
<p:outputLabel value="Edit mode:"/>
<p:selectOneButton value="#{offers.creationMode}">
<f:selectItems value="#{offers.creationModes}"/>
<p:ajax update="#form"/>
</p:selectOneButton>
</h:panelGroup>
<p:panelGrid>
<p:row>
<p:column>
<p:outputLabel value="Row 1:"/>
</p:column>
<p:column>
<p:inputText>
<p:ajax/>
</p:inputText>
</p:column>
</p:row>
<p:row rendered="#{offers.displayAdvancedModeComponents()}">
<p:column>
<p:outputLabel value="Row 2:"/>
</p:column>
<p:column>
<p:inputText>
<p:ajax/>
</p:inputText>
</p:column>
</p:row>
</p:panelGrid>
</h:form>
</p:dialog>
<p:dialog id="myDialog" widgetVar="myDialogVar" modal="true">
<h:form>
<h:panelGroup>
<p:outputLabel value="Edit mode:"/>
<p:selectOneButton value="#{offers.creationMode}">
<f:selectItems value="#{offers.creationModes}"/>
<p:ajax update="#form"/>
</p:selectOneButton>
</h:panelGroup>
<p:panelGrid>
<p:row>
<p:column>
<p:outputLabel value="Row 1:"/>
</p:column>
<p:column>
<p:inputText>
<p:ajax/>
</p:inputText>
</p:column>
</p:row>
<p:row rendered="#{offers.displayAdvancedModeComponents()}">
<p:column>
<p:outputLabel value="Row 2:"/>
</p:column>
<p:column>
<p:inputText>
<p:ajax/>
</p:inputText>
</p:column>
</p:row>
</p:panelGrid>
</h:form>
</p:dialog>
</ui:composition>
The first dialog myDialog does not respond to changes of the creation mode (BASIC and ADVANCED) whereas the second identical myDialog does. The first one should respond as well like it does when everything is declared in index.xhtml without using the template.
The dialogs are identical in order to show that the issue occuring for the first dialog and not for the second doesn't have anything to do with the structure of the dialog. The example doesn't have any function except illustrating the unexpected behavior (p:inputText isn't bound to backing bean values, etc.).
MCVE is at https://github.com/krichter722/primefaces-datatable-row-not-updated.
I'm using Primefaces 6.1.
I have used p:layoutUnit to set up a menu on the left and a main page on the right. This works ok until I add a p:dialog. Now when I select the stocks menu item the whole page refreshes instead of just the main page. I realise p:dialog applies to the whole page since it is modal, so I wondered what is the correct way to implement this to avoid a whole page refresh?
Here is my layout:
Index2.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:head>
<title>Index2</title>
</h:head>
<h:body>
<p:layout style="min-width:400px;min-height:700px;">
<p:layoutUnit position="west" resizable="false" size="300" minSize="40" maxSize="200">
<h:form>
<p:menu>
<p:submenu label="Menu">
<p:menuitem value="Stocks" outcome="stocks" />
<p:menuitem value="Portfolio" outcome="portfolio"/>
</p:submenu>
</p:menu>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<h3 style="margin-top:0">Plain Menu</h3>
<ui:insert name="source" />
</p:layoutUnit>
</p:layout>
</h:body>
</html>
Stocks.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
template="index2.xhtml">
<ui:define name="source">
<script type="text/javascript">
function handleMessage(data)
{
if(data == 'price')
{
updateWidget();
console.log("stocks: data is price");
}
}
function onError(){
console.log("on error");
}
function onStart(){
console.log("on start");
}
function onComplete(){
console.log("on complete");
}
function onSuccess(){
console.log("on success");
}
</script>
<h:form id="form">
<p:dataGrid id="prices" var="orderBooks" value="#{stocksView.latestPricesResults}" columns="3" rows="12">
<f:facet name="header">
WST 100
</f:facet>
<p:column>
<p:panel header="#{orderBooks.bidOrderId.member.memberId}">
<h:panelGrid columns="1">
<h:outputText value="#{orderBooks.price}" />
<h:outputText value="#{orderBooks.bidOrderId.member.party}" />
<h:outputText value="#{orderBooks.lastUpdate}" />
<p:commandLink update=":form:buyDetail" oncomplete="PF('buyDialog').show()" title="View Detail">
<h:outputText value="Buy"/>
<f:setPropertyActionListener value="#{orderBooks}" target="#{stocksView.selectedStock}" />
</p:commandLink>
</h:panelGrid>
</p:panel>
</p:column>
</p:dataGrid>
<p:dialog header="Buy Shares" widgetVar="buyDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false" appendTo="#(body)">
<p:outputPanel id="buyDetail" style="text-align:center;">
<p:panelGrid columns="2" columnClasses="label,value">
<h:outputText value="Member" />
<h:outputText value="#{stocksView.selectedStock.bidOrderId.member.memberId}" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>
<p:remoteCommand name="updateWidget"
actionListener="#{stocksView.findLatestPrices}"
autoRun="true"
update="prices"
onstart="onStart()"
oncomplete="onComplete()"
onsuccess="onSuccess()"
onerror="onError()">
</p:remoteCommand>
</h:form>
<p:socket onMessage="handleMessage" channel="/notify" />
</ui:define>
</ui:composition>
I'm trying to open a dialog from the backing bean, but I got this: Uncaught TypeError: Can not read property 'show' of undefined
this is my code to call the dialog from the bean:
RequestContext.getCurrentInstance().update("someForm:confirmDialog");
context.execute("PF('confirmDialog').show()");
This is part if my backing bean:
#SuppressWarnings("serial")
#ManagedBean
#ViewScoped
public class SomeBean implements Serializable{
private String something = "";
private ObjectCast newDefault = null;
private List<SomeObject> list = null;
public void onEdit(RowEditEvent event) {
newDefault = (ObjectCast)event.getObject();
if( newDefault.getDefault().equals("X") ){
RequestContext context = RequestContext.getCurrentInstance();
RequestContext.getCurrentInstance().update("someForm:confirmDialog");
context.execute("PF('confirmDialog').show()");
}
public void updateNewDefault(){
... do something...
}
.... getters and setters ...
}
Xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/commonTemplate.xhtml">
<ui:define name="content">
<h:form id="someForm">
<p:growl id="msg" showDetail="true" life="3000" autoUpdate="true"/>
<p:panelGrid width="100%">
<p:row>
<p:column colspan="4">
<p:dataTable id="search" var="result" value="#{someBean.list}" editable="true">
<!-- ajax -->
<p:ajax event="rowEdit" listener="#{someBean.onEdit}" update=":someForm:msg" />
<p:ajax event="rowEditCancel" listener="#{someBean.onCancel}" update=":someForm:msg" />
<p:column headerText="title" sortBy="#{result.somePropertie}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{result.somePropertie}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{result.somePropertie}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Edit" style="width:50px;" >
<p:rowEditor />
</p:column>
</p:dataTable>
</p:column>
</p:row>
<p:row>
<p:column colspan="4"> </p:column>
</p:row>
<p:confirmDialog id="confirmDialog"
widgetVar="confirmDialog"
message="Message ......................"
header="Warning"
severity="alert"
closeOnEscape="true"
width="600"
showEffect="slide"
hideEffect="fold"
closable="true">
<p:commandButton id="btnYes"
value="Yes"
process="#this"
oncomplete="PF('confirmDialog').hide()"
actionListener="#{someBean.updateNewDefault}"
/>
<p:commandButton id="btnNo"
value="No"
onclick="PF('confirmDialog').hide()"
type="button" />
</p:confirmDialog>
</p:panelGrid>
</h:form>
</ui:define>
</ui:composition>
I have a barChart where I use extend to modify datapoint, when I put that and the following js code, my dialog stops working ... why ??
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
<h:head>
<title>Chart</title>
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/css/default.css"/>
<script type="text/javascript">
function chartExtender() {
this.cfg.seriesDefaults = {
renderer:$.jqplot.BarRenderer,
pointLabels: { show: true }
};
this.cfg.highlighter = { show: false };
}
</script>
</h:head>
<h:body style="background-color: #E1E1E1;">
<p:panelGrid columns="1" columnClasses="left" style="width:100%">
<p:barChart id="basic" value="#{someBean.categoryModel}" legendPosition="ne"
title="some Title" min="0" max="#{someBean.max}" style="height:400px"
shadow="true" barPadding="60" animate="true" extender="chartExtender"
/>
</p:panelGrid>
</h:body>
</html>
Thanks!!
I'm new to primefaces JSF, I have three pages called Template page, Master page with dialog option and bean attached with dialog option but when I click command button in dialog box the bean method not calling. please help us if anybody knows about this issue. Thanks
MasterTemplate.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
<h:head>
<f:facet name="first">
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
<title><h:outputText value="#{prop.application_name}"/></title>
</f:facet>
<link type="text/css" rel="stylesheet" href="${facesContext.externalContext.requestContextPath}/css/default.css"/>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit header="#{prop.application_name}" position="north" size="240" resizable="false" closable="false" collapsible="true">
<h:form id="toolBarForm">
<p:toolbar>
<p:toolbarGroup align="right">
<h:outputText value="Welcome :#{sessionScope.userName}"/>
<p:separator />
<p:commandButton action="#{userLogout.logout}" value="#{prop.Template_button}" ajax="false" />
<p:menuButton value="Quick Access">
<p:menuitem action="ChangePassword" icon="ui-icon-key" value="Change password"/>
<p:menuitem icon="ui-icon-person" value="View Profile"/>
<p:menuitem action="#{userLogout.logout}" icon="ui-icon-locked" value="Logout"/>
</p:menuButton>
</p:toolbarGroup>
</p:toolbar>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="west" size="300" header="#{prop.Template_Menu_Header}" collapsible="true">
<h:form id="f2">
<p:tree value="#{menuBean.root}" var="node" id="tree" highlight="true "
selection="#{menuBean.selectedNode}"
selectionMode="single" >
<p:ajax event="select" listener="#{menuBean.onNodeSelect}" update=":mainArea"/>
<p:treeNode id="treeNode" >
<h:outputText value="#{node}"/>
</p:treeNode>
</p:tree>
</h:form>
</p:layoutUnit>
<ui:insert name="MainBody" />
<p:layoutUnit header="#{prop.application_footer}" position="south" closable="false" collapsible="false">
</p:layoutUnit>
</p:layout>
</h:body>
</f:view>
</html>
default.xhtml
<ui:composition template="templates/MasterTemplate.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<ui:define name="MainBody">
<p:layoutUnit position="center">
<h:panelGroup id="mainArea">
<ui:include src="#{menuBean.renderPage}"/>
</h:panelGroup>
</p:layoutUnit>
</ui:define>
</ui:composition>
ThirdPage.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title> Title</title>
</h:head>
<h:body>
<h:form id="test">
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton value="New User" onclick="newUserDialog.show()"/>
<p:commandButton action="#{lbc.login}" process="#test" value="View" >
</p:commandButton>
<p:commandButton type="button" value="Edit" title="Update" icon="ui-icon-pencil">
</p:commandButton>
<p:separator />
<p:commandButton type="button" value="Delete" title="Delete" icon="ui-icon-trash"/>
</p:toolbarGroup>
<p:toolbarGroup align="right">
<p:commandButton type="button" value="Search" icon="ui-icon-search"/>
</p:toolbarGroup>
</p:toolbar>
</h:form>
<h:form prependId="false">
<p:dialog header="Create New User" widgetVar="newUserDialog" resizable="true" id="newUserDlg" >
<h:panelGrid id="region" columns="2" cellpadding="5">
<h:outputLabel for="username" value="Username:" />
<p:inputText value="#{lbc.username}"
id="username" required="true" label="username" />
<h:outputLabel for="password" value="Password:" />
<p:password value="#{lbc.password}"
id="password" required="true" label="password" />
<f:facet name="footer">
<p:commandButton partialSubmit="true" action="#{lbc.login}" value="add">
</p:commandButton>
</f:facet>
</h:panelGrid>
</p:dialog>
</h:form>
</h:body>
</html>
package mod.om.login;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.event.ActionEvent;
import javax.faces.event.AjaxBehaviorEvent;
#ManagedBean(name = "lbc")
#RequestScoped
public class LoginBean implements Serializable{
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public void login() {
System.out.println("Called");
}
}
I had the same problem; but in my case, it was when I migrated primefaces from version 5.0 to 6.2.
I solved it removing the <f:facet name="footer"... or wrapping with <h:panelGrid ... the <p:commandButton ... like the following example.
<f:facet name="footer">
<h:panelGrid columns="1" >
<p:commandButton partialSubmit="true" action="#{lbc.login}" value="add">
</p:commandButton>
</h:panelGrid>
</f:facet>
I am using JSF 2.0 with PrimeFaces 3.0 M3. When I set dynamic="false" on <p:tabView>, then it works fine. But when I set it to true, then only the currently active tab works. Other tabs does not run. In the 1st tab I have a command link in a data table, this is also not working.
Below is my tabletabview.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
</h:head>
<h:body>
<f:view>
<h:form>
<p:growl id="growl" showDetail="true" />
<p:tabView cache="false" dynamic="true" activeIndex=0 >
<p:ajax event="tabChange" listener="ActivityController.onChange"/>
<p:tab title="Search Results 1">
<p:dataTable var="dataItem" value="#{ActivityController.dataList}">
<p:column>
<p:panel style="font-size:12px;width:600px">
<f:facet name="header">
<h:outputText value="#{dataItem.activityname}" />
</f:facet>
<div style="background-color: #DEB887;">
<h:outputText value="Location:" style="color:#FF0000;"></h:outputText>
<h:outputText value="#{dataItem.address}" />
<br></br>
</div>
<div style="background-color: #DEB887;">
<h:outputText value="Start Date:" style="color:#FF0000;"></h:outputText>
<h:outputText value="#{dataItem.startingdate}" />
<br></br>
</div>
<div style="background-color: #DEB887;">
<h:outputText value="Start Date:" style="color:#FF0000;"></h:outputText>
<h:outputText value="#{dataItem.endingdate}" />
</div>
<div style="background-color: #DEB887;">
<h:outputText value="Description:" style="color:#FF0000;"></h:outputText>
<h:outputText value="#{dataItem.description}" />
<br></br>
</div>
<p:commandLink action="#{ActivityController.editDataItem}">
<div style="display: none">
<h:outputText value="#{dataItem.activityname}" />
</div>
<h:outputText value="more....."></h:outputText>
<f:setPropertyActionListener target="#{ActivityController.dataItem}" value="#{dataItem}" />
</p:commandLink>
</p:panel>
</p:column>
</p:dataTable>
</p:tab>
<p:tab title="Search Results 2">
<p:panel style="width:600px;height:600px">
<p:schedule id="sche" value="#{searchController.eventModel}"
editable="true" draggable="false" resizable="false"
widgetVar="myschedule">
<p:ajax event="eventSelect"
listener="#{searchController.onEventSelect}" update="red"
process="#this" />
</p:schedule>
</p:panel>
</p:tab>
<p:tab id="gmap" title="Search Results 3">
<ui:include src="/locationpointers.xhtml"></ui:include>
</p:tab>
</p:tabView>
</h:form>
</f:view>
</h:body>
</html>
This is the relevant part of my ActivityController.java
public List<ActivityRegBean> getDataList() {
return dataList;
}
public void setDataList(List<ActivityRegBean> dataList){
this.dataList=dataList;
}
private ActivityRegBean dataItem;
private HtmlInputHidden dataItemId = new HtmlInputHidden() ;
public String editDataItem() throws IOException {
FacesContext context = FacesContext.getCurrentInstance();
System.out.println(dataItem.activityname);
dataItemId.setValue(dataItem.activityid);
System.out.println(dataItem.activityid);
retfromtable(dataItem.activityname);
return "edit"; // Navigation case.
}
public void onChange(TabChangeEvent event) {
System.out.println("tab id = " + event.getTab().getId());
}
The ActivityRegBean has a getter and setter.
How can I use dynamic="true" on the <p:tabView> without problems?
Can you try this instead of p:ajax
<p:tabView cache="false" dynamic="true" tabChangeListener="#{ActivityController.onChange}" onTabChangeUpdate="growl">
I have noticed that you are using xmlns:p="http://primefaces.prime.com.tr/ui" . It is for primefaces 2.2 and if you are indeed using primefaces 3, then it will complain about no taglibrary exists for that namespace. for PF3 you should be using xmlns:p="http://primefaces.org/ui" . may be you should clean your work directory.