Hi Scott, 

Congrats - sounds like an interesting piece of functionality. From the 
description, it seems like it might be somewhat app-specific, but also sounds 
like a valuable example that others could learn from. We have actually been 
having a discussion on the dev list recently about where code such as this 
could be shared. Don't have anything definitive yet, but I imagine we will soon.

As for paging - this is always a difficult problem to solve. The biggest 
challenge is that, unless you cache the entire result set on the server, the 
contents of any given page can change across requests. I generally prefer to 
use a stateless approach when possible.

However, if you do need paged results, one way to do it would be to create a 
custom List class that retrieves pages on demand. That way, you don't need a 
dedicated paging toolbar, and the user experience is more seamless.

G


On Feb 24, 2010, at 5:04 PM, Scott Baxter wrote:

> Late last week I posted a question about filtering TableView
> components and was pointed in the direction of using a filtered list.
> So, I did some more thinking, and decided to build a new component
> similar to the TableViewHeader.
> 
> Basically, I wanted a component that I could put above the
> TableViewHeader, that would present me with a list of the columns in
> the table and a textbox to enter the string to filter by.
> 
> So I built a TableViewFilter (which might not be the best name) by:
> 
> 1.  Extending the BoxPane class.
> 2.  Adding a ListView (to select the desired column to filter) and
> TextInput (to enter the filter itself) to the BoxPane.
> 3.  Adding a "tableView" property to my new component ala the
> TableViewHeader (so in the WTKX you can instantiate the new component
> and pass it a tableView just like with the header).
> 4.  When the setTableView is called, I populate the aforementioned
> ListView with the HeaderData of each column in the TableView.
> 5.  Wiring up a textInputKeyListener on the TextInput that applies (or
> clears) a filter on the underlying FilteredList on every character
> added or removed (I had a "go" button, but decided the key listener
> was slicker).
> 6.  For now, the filter just compares the toString method of the
> Object in the selected column with the text in the TextInput.
> 
> Anyway, after much trial and error, it works.  I have a few questions though:
> 
> 1.  Does anyone have a cleaner or easier way to implement the above?
> 2.  I'm not sure my code is contribution quality, but it might help
> someone, somewhere.  Where would be a good place to put it for other
> to see and laugh at?
> 
> As a follow on, I also need the ability to "Page" my table views (in
> other words, get them back from the server and display them in smaller
> chunks).  So I think I want to write a TableViewPaginator that works
> like the header, but instead resides in the footer.  Does anyone have
> any general ideas on the best way to tackle this?

Reply via email to