One thing I am not quite sure about is following. When I pull using db queries, how can it filter itself instantly? Do I need to write some code, or setupRender function does it for me. Lets say I have created one function like following:
@Inject private BiznisLogika biznisLogika; @Property //@Persist private List<Tiket> listaTiketa; @InjectComponent private Zone zonaZaTikete; void pageLoaded() { listaTiketa = getTikete(); } /** * This event is fired by the observe mixin */ Block onFilter(String ticketSerial, String ticketNumber) { //Date parsedDatum = parseDate(datumZaPromjenu); List<Tiket> filtered = new ArrayList<Tiket>(); for (Tiket tiketaa : getTikete()) { //boolean include = datumZaPromjenu == null || phone.name.toLowerCase().contains(name.toLowerCase()); //biznisLogika.izlistajSveTiketePoRestrikciji(ticketSerial) boolean include = ticketSerial == null || ticketSerial.equals(biznisLogika.preuzmiSerijskiBrojTiketa(tiketaa)); //tiketaa.getTicketSerial().toLowerCase().contains(ticketSerial.toLowerCase()); include &= ticketNumber == null || ticketNumber.equals(biznisLogika.preuzmiBrojTiketa(tiketaa)); if (include) { filtered.add(tiketaa); } } listaTiketa = filtered; return zonaZaTikete.getBody(); } public List<Tiket> getTikete() { return biznisLogika.izlistajSveTikete(); } Now when I type in my textfield some value, sending a lot of reqs to db is something that shouldn't be done too much often. The way to implement it using a submit button is a lot easier for me, but I would like to do just as shown in your example, @Lava. > Date: Mon, 6 Oct 2014 08:41:03 +0100 > Subject: Re: Stitch observe component applied over DB entities > From: lance.j...@googlemail.com > To: users@tapestry.apache.org > > You're not really helping yourself here.... > > Saying "it doesn't work" won't really get you very far. > Have you put a debug breakpoint in? > Have you seen a non null date? > > > Maybe I should declare listaTiketa with @Persist > You have a perfectly working example on tapestry stitch doing (almost) > exactly what you need. Since the example doesn't use @Persist, I hope it's > obvious that you won't need it either. > > Rather than bringing back all records from the database and filtering in > the jvm. You should instead use a db query to filter the results. The > stitch example is for simple demonstration purposes.