Any component inside p:tabView / p:tab with update another component in another p:tab, in separate forms, show log message "INFO: Cannot find component with identifier...".
In addition, the component in another tab is not updated. This is the code:
TabControl.java
-----------------------
import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
@Named
@SessionScoped
public class TabControl implements Serializable {
private static final long serialVersionUID = 1L;
private String strTest = "First Test. Click the button to replace.";
public String getStrTest() {
return strTest;
}
public void replaceTest() {
System.out.println("TabControl.replaceTest()");
strTest = "Second Test. Replaced.";
}
}
index.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.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head></h:head>
<h:body>
<p:tabView>
<p:tab title="Tab 1">
<h:form id="form1">
<p:commandButton value="Replace Text in Tab 2" update=":form2" action="#{tabControl.replaceTest}"/>
</h:form>
</p:tab>
<p:tab title="Tab 2">
<h:form id="form2">
<h:outputText value="#{tabControl.strTest}" />
</h:form>
</p:tab>
</p:tabView>
</h:body>
</html>
update issue in p:tabView-Cannot find component with ident..
-
- Posts: 3
- Joined: 12 Dec 2011, 17:07
Maycon Jose
PrimeFaces 3.0.RC1
Glassfish 3.1.1
Mojarra 2.1.4
PrimeFaces 3.0.RC1
Glassfish 3.1.1
Mojarra 2.1.4
I am trying to do something similar. The only difference is that I am updating a datatable in tab one from an 'add' form in tab 2.
When a user add a record via tab 2, the datatable isn't updated in tab 1. I have the correct update selector listed. I need to do this a lot.
I saw that the ticket opened for this issue was marked as 'User Error' and closed by Cagtay. That's fine, but can I get an explanation why this a 'user error'. should I be using something else to accomplish this. I don't like using a lot of modal lightboxes; it can obfuscate functionality.
Eventually I hope that datatables will have a bult in 'add new record' button that is triggered by the <p:roweditor/> on an empty row. That's just me dreaming though.
To summarize, please state why updating one tab from another inside the same tabview is not advisable.
I will probably try and accomplish this via requestContext. but we'll see how that works.
When a user add a record via tab 2, the datatable isn't updated in tab 1. I have the correct update selector listed. I need to do this a lot.
I saw that the ticket opened for this issue was marked as 'User Error' and closed by Cagtay. That's fine, but can I get an explanation why this a 'user error'. should I be using something else to accomplish this. I don't like using a lot of modal lightboxes; it can obfuscate functionality.
Eventually I hope that datatables will have a bult in 'add new record' button that is triggered by the <p:roweditor/> on an empty row. That's just me dreaming though.
To summarize, please state why updating one tab from another inside the same tabview is not advisable.
I will probably try and accomplish this via requestContext. but we'll see how that works.
3.3.1
WebSphere 7
Mojarra 2.0.4
From another forum member:
I've just fixed the problem on IE7...
I personally hate IE7 with all my heart but still need to support it for some time.
WebSphere 7
Mojarra 2.0.4
From another forum member:
I've just fixed the problem on IE7...
I personally hate IE7 with all my heart but still need to support it for some time.
- kwintesencja
- Posts: 316
- Joined: 08 Feb 2010, 20:33
- Location: Brazil
Hi there, Tabview is also a naming container so its id must be in the update
i think a single form for the tabview should work better and be easier to mantain, something like:
I hope it helps.
Code: Select all
<!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"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head></h:head>
<h:body>
<p:tabView id="tabviewID">
<p:tab title="Tab 1">
<h:form id="form1">
<p:commandButton value="Replace Text in Tab 2" update=":tabviewID:form2" action="#{tabControl.replaceTest}"/>
</h:form>
</p:tab>
<p:tab title="Tab 2">
<h:form id="form2">
<h:outputText value="#{tabControl.strTest}" />
</h:form>
</p:tab>
</p:tabView>
</h:body>
</html>
Code: Select all
<h:form id="mainForm">
<p:tabView id="tabviewID">
<p:tab title="Tab 1">
<p:commandButton value="Replace Text in Tab 2" update=":mainForm:tabviewID:idOutput" action="#{tabControl.replaceTest}"/>
</p:tab>
<p:tab title="Tab 2">
<h:outputText id="idOutput" value="#{tabControl.strTest}" />
</p:tab>
</p:tabView>
</h:form>
I hope it helps.
Att,
--
Rafael Mauricio Pestano
Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano
--
Rafael Mauricio Pestano
Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano
-
- Posts: 3
- Joined: 12 Dec 2011, 17:07
Thanks kwintesencja, its solved.
Maycon Jose
PrimeFaces 3.0.RC1
Glassfish 3.1.1
Mojarra 2.1.4
PrimeFaces 3.0.RC1
Glassfish 3.1.1
Mojarra 2.1.4
- kwintesencja
- Posts: 316
- Joined: 08 Feb 2010, 20:33
- Location: Brazil
great, you're welcome
Att,
--
Rafael Mauricio Pestano
Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano
--
Rafael Mauricio Pestano
Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano
-
- Information
-
Who is online
Users browsing this forum: No registered users and 31 guests