« Return to Thread: Advice on using tree and/or "table row group"

Re: Advice on using tree and/or "table row group"

by Rick Fincher :: Rate this Message:

Reply to Author | View in Thread

Hi Ted,

Tables are pretty flexible.  The cell in a table can be essentially any
ui widget.  The standard ones are string, button, checkbox, radio
button, hyperlinks, images, image hyperlinks, etc.

You can also put a GroupPanel in a cell which can contain anything a
panel normally has.  To populate each cell based on what is in the table
row, you set it to be equal to a property.

As the system draws each row of the table it call the getter for the
property to fill that value.  So, you just write the getter to return
what you want.  You can get parameters to calculate what you want by
using something like this in the getter method:

String lastName = (String)
getValue("#{currentRow.value['mySQLTable.LAST_NAME']}");

Your getter method can take the value of last name and perform other
database lookups to populate a tree, for example.

Your cell can have submit buttons, etc. to do things with the data.

You can also get data from other cells in the current row and calculate
sums, etc. from those cells to display in your cell.

You can also add stuff to the footer of a table so that you can sum
values of columns.  There again you use a property with a getter
method.  The getter could step through the tableRowGroup and sum up the
values.

Alternately, you could have a property for the cell to be summed and use
its getter method to not only display the cells value, but add it to a
running total, so that when the footer of the table renders, it just
displays the running total without having to iterate through the data
table again.

You can dynamically add or remove or show and hide table columns at runtime.

You can also use filters to select which rows to show based on some
logic that you design based on user selections.

The table ultimately gets rendered as a HTML table, so it's pretty flexible.


Rick

TedByers wrote:

> I have never explicitly use either a tree or a table row group in a JSF
> application (although I have in standalone applications created using C++
> and a proprietary application framework).  I do see, though, that a single
> row group is used by default.
>
> I suppose the path of least resistance would be to use the table, and figure
> out how many table row groups are required dynamically at run time and then
> figure out how to create the required number of row groups.  Consider, for
> example, a situation where you have data for your distributors and dealers,
> for your business.  Consider also you're creating a report providing some
> kind of summary snapshot of, e.g. sales and profits.  Getting the data from
> a database is not much of a problem (some sort of select, with aggregation
> functions like sum or avg, with a group by involving distributors and
> dealers, and possibly an order by clause to ensure a rational order in the
> output).
>
> And with such hierarchical data, a tree may be a more natural control than a
> table with a bunch of subtables.  Either way, how would one construct either
> at run time based on the data returned from the DB?  And, can a tree node
> display a table (i.e. I am thinking maybe a tree to manage distributors and
> any distributors they may sell to, and at the merchant level display a
> simple table? Or perhaps handle each distributor's dealers in a table row
> group within a single, albeit more complex table?
>
> I was also thinking about support for drill down exploration of the data.
> Any thoughts on how easy or difficult that may be with existing JSF
> controls?  If I add such support, I'd want to be able to keep the original
> table(s) providing drill down support visible.  For example, if the dealers'
> sales are initially displayed by categories of products, and that table
> supports drill down data exploration, that table ought to remain visible
> while the data for each product within the product category selected is
> displayed.  I want to make navigation through the data as simpl and natural
> as possible without an excessive number of pages to be loaded.  Any thoughts
> on how well these controls would support such functionality?
>
> At the heart of the matter is the question of can one dynamically create an
> arbitrary number of table row groups, in the case of the tables, or an
> arbitrary number of nodes on a tree control, and if so, how/where would you
> put the code that computes this from hierarchical data drawn from a
> database?
>
> Thanks
>
> Ted
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: Advice on using tree and/or "table row group"