jsf - Update a dataTable from calendar dateSelect event -


i'm trying update datetable calendar dateselect event. i'm newbie using primefaces , tomcat.

this code

index.xhtml

<h:body>    ...    <h:form id="cites">      <p:calendar id="calendari" value="#{indexbean.calendari}" mode="inline" locale="va">        <p:ajax event="dateselect" listener="#{indexbean.ondateselect}" update="taulahores"/>      </p:calendar>            <p:datatable id="taulahores" var="hores" value="#{indexbean.hores}"                    widgetvar="taulahores" emptymessage="sense resultats"                   filteredvalue="#{indexbean.horesfiltrades}" style="width:1000px"                   selection="#{indexbean.horaseleccionada}" rowkey="#{hores.hora}">        <p:column selectionmode="single" style="width:16px;text-align:center"/>        <p:column id="horacol" headertext="hora">          <h:outputtext value="#{hores.hora}">            <f:convertdatetime type="time" pattern="hh:mm"/>          </h:outputtext>        </p:column>          <p:column id="numerohistoriacolbis" headertext="nhc" >          <h:outputtext value="#{hores.nhc}" rendered="#{not null}" />          <h:outputtext value="lliure" rendered="#{hores.nhc eq null}" />        </p:column>                <p:column id="nomcolbis" headertext="nom" >          <h:outputtext value="#{hores.nom}" rendered="#{not null}" />          <h:outputtext value="" rendered="#{hores.nom eq null}" />        </p:column>                          <p:column id="lliangescolbis" headertext="llinages" >          <h:outputtext value="#{hores.llinages}" rendered="#{not null}" />          <h:outputtext value="" rendered="#{hores.llinages eq null}" />        </p:column>            </p:datatable>        </h:form>        </h:body>

indexbean.java

public indexbean() {    omplirhores(new date(system.currenttimemillis()));  }    public void ondateselect(selectevent event) {    omplirhores((date)event.getobject());  }    private void omplirhores(date dia){    simpledateformat dateformat = new simpledateformat("yyyy-mm-dd");        this.hores = genericdao.sql("select hores.hora hora, hores.numerohistoria nhc, persona.nom nom, persona.llinages llinages " +        "from hores left join persona on hores.numerohistoria=persona.numerohistoria " +        "where hora>='"+dateformat.format(dia)+" 00:00:00' , hora<='"+dateformat.format(dia)+" 23:59:59'" +        "order hores.hora asc;");        system.out.println("llistahores " + this.hores.size());  }

then, when index.xhtml loaded, datatable 'taulahores' filled right. problem when select date in calendar, rows on datatable disappear , not updated new values sql query.

for more information, see in log size of 'hores' right.

please, ideas?

thanks in advance

solved removing filteredvalue="#{indexbean.horesfiltrades}" property


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -