spring - selecting primefaces datatable not working -


i have problem selection primefaces datatable. when choose record setter doesn't invoke. found couple solution change template or change viewscope i'm changing still does't work template.xhtml

<!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsf/composite/custom" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <title><ui:insert name="title">default title</ui:insert></title> <f:facet name="first">     <meta http-equiv="x-ua-compatible" content="ie=edge" />     <meta content="text/html; charset=utf-8" http-equiv="content-type" />     <meta name="viewport" content="width=device-width, initial-scale=1" />     <title>social test</title> </f:facet> <f:facet name="middle">     <h:outputstylesheet name="bootstrap/css/bootstrap.css" />     <h:outputstylesheet name="css/style.css" />     <h:outputstylesheet name="bootstrap/css/bootstrap-social.css" />     <script         src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" />     <h:outputscript name="bootstrap/js/bootstrap.js" />     <!-- h:outputscript name="js/script.js" /--> </f:facet> <f:facet name="last"> </f:facet> </h:head> <h:body>     <div id="header"></div>     <div id="menu"></div>     <div id="content">         <ui:insert name="content"></ui:insert>     </div>     <div id="footer"></div> </h:body> </html> 

ticketedit.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">  <ui:composition template="/template/template.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:c="http://java.sun.com/jsf/composite/custom" xmlns:p="http://primefaces.org/ui"> <ui:define name="content">             <h2 class="form-signin-heading">#{labres.add_ticket}</h2>             <h:form id="form">                 <p:accordionpanel>                     <p:tab title="#{labres.train_details}">                         <h:panelgrid columns="2" cellpadding="10">                             <c:autocomplete                                 completemethod="#{ticketbean.trainautocompletebean.complete}"                                 minquerylength="2"                                 converter="#{ticketbean.trainautocompletebean.converter}"                                 namelable="#{labres.train_number}"                                 autovalue="#{ticketbean.selectedtrain}" forceselection="true"                                 querydelay="500" effect="fade" cid="ticketauto" listener="null"                                 labelstyleclass="labelpaddingparameter" ajax="true"                                 update="@form" />                             <c:inputtext id="nr" cid="cnr"                                 namelable="#{labres.train_number}" disabled="true"                                 inputvalue="#{ticketbean.selectedtrain.name}"                                 labelstyleclass="labelpaddingparameter" />                         </h:panelgrid>                     </p:tab>                     <p:tab title="#{labres.train_details}">                         <h:panelgrid columns="1" cellpadding="10" id="pgtraindetails">                             <c:calendar pattern="mm-dd-yyyy" value="#{ticketbean.day}"                                 islistener="true" update=":form" ajax="true"                                 namelable="#{labres.departure_date}" cid="depdat"                                 listener="#{ticketbean.ondateselect}" />                             <p:datatable var="schedule" value="#{ticketbean.tripschedules}"                                 selectionmode="single"                                 selection="#{ticketbean.selectedschedule}"                                 rowkey="#{schedule.id}" styleclass="picklistwidth"                                 paginator="true" rows="10"                                 paginatortemplate="{currentpagereport}  {firstpagelink} {previouspagelink} {pagelinks} {nextpagelink} {lastpagelink} {rowsperpagedropdown}"                                 rowsperpagetemplate="5" id="scheduletable">                                 <f:facet name="header">                                     <c:calendar pattern="mm-dd-yyyy" value="#{ticketbean.day}"                                         islistener="true" update=":form" ajax="true"                                         namelable="#{labres.departure_date}" cid="depdat"                                         listener="#{ticketbean.ondateselect}" />                                 </f:facet>                                 <p:column headertext="#{menres.id}" sortby="#{schedule.id}"                                     style=" text-align:center">                                     <h:outputtext value="#{schedule.id}" />                                 </p:column>                                 <p:column headertext="#{labres.departure_time}"                                     sortby="#{schedule.departure}" style="text-align:center">                                     <h:outputtext value="#{schedule.departure}" />                                 </p:column>                              </p:datatable>                         </h:panelgrid>                     </p:tab>                     <p:tab title="#{labres.ticket_details}">                         <h:panelgrid columns="2" cellpadding="10">                         </h:panelgrid>                     </p:tab>                 </p:accordionpanel>             </h:form> </ui:define> 

my bean (i'm using spring) have use @viewscope because spring does't contain @scope('view')

 // same annotations in abstractbean   @component     @viewscope  //faces  bean package  public class ticketbean extends abstractbean {    ... code ...   public tripschedule getselectedschedule() { return selectedschedule; }  public void setselectedschedule(tripschedule selectedschedule) { this.selectedschedule = selectedschedule; } 

thanks !

i think need add ajax datatable:

<p:ajax event="rowselect"/> <p:ajax event="rowunselect"/> 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -