Panel Ajax close Event

UI Components for JSF
Post Reply
epsillo
Posts: 8
Joined: 02 Feb 2012, 09:56

20 Mar 2012, 15:26

Hallo,
My problem is when i click on the close icon on the panel the panel closes but the ajax event is not fired
Here my xhtml

Code: Select all

<?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:p="http://primefaces.org/ui"

      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <h:body>

        <ui:composition template="index_static.xhtml" >
            <ui:define name="content">

                <h:form> 
                                     

                    <!-- wenn kein GET-Parameter -->
                    <!-- Output-Container für die News-Liste -->
                    <p:dataGrid value="#{newsController.newsList}" var="news" 
                                id="_newsContainer#{news.newsID}" columns="1" rows="10"
                                paginator="true" paginatorPosition="bottom"
                                paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                                paginatorAlwaysVisible="false"
                                style="min-height: 650px"
                                rendered="#{newsController.news == null}">                        

                        <!-- Output-Container für je eine News -->
                       <p:growl id="growl" showDetail="true"/>   
                       <p:panel toggleable="false" closable="true" id="_news#{news.newsID}" header="#{news.titel}" 
                                widgetVar="panel" visible="#{news.aktiv}">  
                            
                            <p:ajax event="close" listener="#{newsController.deleteNews}" update="growl"/>
                            
                            <h:outputText value="#{news.inhalt}" />  
                            

                            
                            
                            <br />
                            <br />
                            <!-- TODO FIX THIS-->
                            <h:outputText style="text-align: right" >
                                von #{news.autor} am ...
                            </h:outputText>
                        </p:panel>  

                    </p:dataGrid>

                    <p:panel rendered="#{newsController.news != null}" 
                             header="#{newsController.news.titel}">
                        <h:outputText value="#{newsController.news.inhalt}" />
                        <br />
                        <br />
                        <p align="right" >von 
                            <a href="profile.xhtml?uid=#{newsController.news.autor.userID}">#{newsController.news.autor}</a></p>
                        <!-- TODO Kommentare -->
                    </p:panel>

                </h:form>

            </ui:define>
        </ui:composition>


    </h:body>

</html>
And here my bean

Code: Select all

@ManagedBean
@RequestScoped
public class NewsController implements Serializable{
....
...
    public void deleteNews(CloseEvent ce){
        System.out.println("sewasd");
    }
    
}


Please need your help
and thanks in advance!

rafagsam
Posts: 2
Joined: 14 Apr 2012, 04:13

14 Apr 2012, 04:20

Hi,
Unfortunately, I'm facing the same problem :( .

Has anyone got a solution for this?

I'm using prime faces 3.2 with myfaces 2.0.2 and TOMCAT 6

thx in advance

rafagsam
Posts: 2
Joined: 14 Apr 2012, 04:13

17 Apr 2012, 19:15

Bingo!...
It was missing a column tag around the panel since it is inside a dataGrid. duh!
So, your structure should look like this:

Code: Select all

<p:dataGrid>
  <p:column>
    <p:panel>
      <p:ajax >
    </p:panel>
  </p:column>
</p:dataGrid>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 48 guests