Hi, Try lazy initialization -- create a propery, say TitleList:
public abstract List<Title> getTitleList(); public abstract void setTitleList(List<Title> titleList); Modify the method getTitles() so that it gets the title list via getTitleList(). If it is null, then the provided code should be executed and the list should be stored using setTitleList(). If it is not null, then the result should be returned directly. The property will be cleared (set to null) automatically at the end of the request. -mb anil wrote: > > Hi - > > I was wondering if anyone knew of a resource which details the order in > which calls get made to an IBasicTableModel implementation? > > I've created a IBasicTableModel which retrieves a full set of titles from > the database and allows pagination. i.e. select * from title. > > I've also created a method at the persistence layer that retrieves a > subset of titles from the database. It basically performs 'select * from > title where title like 'X%' where X is a string. > > What I'm trying to do is allow someone to enter a search term into a text > field, click go, and get the subset of results displayed in the list on > the same page as the full list was displayed. > > I have successfully got the values out of the list, but every time I click > Go the search gets performed (I can confirm this by using logging to see > the search get performed) , but then the page gets rendered, and the full > table gets displayed again - i.e. I don't get my filtered results! > > I pressume this is because when the page is rendered it calls getModel() > which in turn calls my implementation of IBasicTableModel, which (when it > calls getCurrentPageRows runs the sql query to get the full list from SQL > again. > > My code is: > > @InjectObject("spring:titleDAO") > public abstract TitleDAO getTitleDAO(); > > @InjectPage("BookCatalogue") > public abstract BookCatalogue getBookCatalogue(); > > public IPage getTitles() { > > logger = > Logger.getLogger("com.semantico.depp.reader.tapestry.components.Letter"); > logger.setLevel(Level.INFO); > logger.info("Calling getTitles()"); > > > TitleDAO titleDAO = getTitleDAO(); > List<Title> titles = titleDAO.getTitlesBeginsStr(getLetter()); > getBookCatalogue().setTitles(titles); > > logger.info("Titles retrieved: " + titles.size()); > return getBookCatalogue(); > > } > > Can anyone let me know how I update the source of my table so that it uses > the new List I have provided it with, rather than calling the database > again to get the full list of results? > > Many thanks in advance for any help! > -- View this message in context: http://www.nabble.com/Updating-table-model-tf2152545.html#a5953226 Sent from the Tapestry - User forum at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]