> >> El 23/11/11 20:06, Thiago H. de Paula Figueiredo escribió: >>> >>> Hi! >>> >>> Template and code please. :) Either way, instead of persisting search >>> results, I just fetch them in getTransactions(). >>> >> >> Well, this is the page .. no special about it >> >> <t:form t:id="searchTransactions"> >> <t:errors/> >> <table> >> <tr> >> <td><t:label for="fromDate"/></td> >> <td><t:datefield t:id="fromDate" format="dd.MM.yyyy"/></td> >> <td><t:label for="toDate"/></td> >> <td><t:datefield t:id="toDate" format="dd.MM.yyyy"/></td> >> <td><input type="submit" t:type="submit" t:id="searchButton" >> value="${message:search}"/></td> >> </tr> >> </table> >> </t:form> >> <legend>Transactions</legend> >> <fieldset> >> <table t:type="grid" t:source="transactions" t:row="currentTransaction" >> t:exclude="id,msisdn,plan,errorCode, country" >> >> t:reorder="transactionDate,transactionType,planName,description,volumeUsed" >> t:rowClass="literal:transactionClass" >> t:rowsPerPage="10"> >> </table> >> </fieldset> >> >> And this is the relevant java code ... >> >> @Property >> @Persist >> private List <Transaction> transactions; >> >> private static Integer [] INVALID_TRANSACTION_TYPES = {0,2,5,9,17,18,24}; >> >> @Property >> private TransactioncurrentTransaction; >> >> >> @Property >> @Validate("required") >> private Date fromDate; >> @Property >> private Date toDate; >> >> >> void onSuccess() { >> if (toDate==null) toDate = Calendar.getInstance().getTime(); >> theTransactions = (List<Transaction>) >> theSession.createCriteria(Transaction.class) >> .add(Restrictions.eq("msisdn", userInfo.getMsisdn())) >> .add(Restrictions.not(Restrictions.in("transactionType", >> INVALID_TRANSACTION_TYPES))) >> .add(Restrictions.ge("transactionDate", startDate(fromDate))) >> .add(Restrictions.le("transactionDate", endDate(toDate))) >> .add(Restrictions.ge("partitionDate", >> Integer.parseInt(tformatter.format(fromDate)))) >> .add(Restrictions.le("partitionDate", >> Integer.parseInt(tformatter.format(toDate)))) >> .addOrder(Order.asc("id")).list(); >> >> } >> >> As i told before, i've managed it using a GridDataSource .. but i'd like >> this to be clarified. >> >> Thanks thiago. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> > > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and > instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate > http://www.arsmachina.com.br
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org