|table displaying jdbc resultset [message #988868]
||Mon, 03 December 2012 13:59
| Knut Wannheden
Registered: July 2009
I am new to NatTable and would like to get some advice on an application
I would like to write. I have clicked myself through the NatTable
examples and I get the impression that NatTable will be able to do
everything I want. But I've also seen that there is many different ways
to populate a table (e.g. using GlazedLists or not), so before I delve
too deep into the code I thought it would be good to get some pointers
from the experts.
1. What I basically want is to build a table which displays a JDBC
2. It should be possible for the user to set the table to update its
contents periodically. It would do that by rerunning the JDBC SQL query
periodically (e.g. once a second).
In a later phase I would like to add some more advanced features:
3. While NatTable doesn't seem to have any trouble displaying huge
amounts of data, executing the query may not be so fast. So I was
thinking of only returning e.g. the first 1,000 rows and then
dynamically add others when the user scrolls down.
4. I would also like to have sorting of columns. That combined with the
partial loading (of 3.) would probably mean that I have to integrate the
NatTable column sorting as an ORDER BY clause into the SQL query instead
of doing the sorting in the UI.
5. I would also like to have the possibility of aggregating data. But
for this I would probably be using SQL GROUP BY and aggregate functions
like COUNT, SUM, and AVG.
6. Also filtering is something I would like to have. Again that would
probably have to be implemented using a SQL WHERE clause.
Please note that I by no means expect a detailed solution to all these
problems. I would just like to get an opinion whether this is feasible
and also some pointers on where to start looking.
Thank you very much in advance,
|Re: table displaying jdbc resultset [message #988880 is a reply to message #988868]
||Mon, 03 December 2012 14:25
| Dirk Fauth
Registered: July 2012
to be honest, I haven't tried to use the NatTable as database viewer yet. But I had some low level discussions recently on that.
The NatTable itself is only a viewer. To create your own way of providing data to the table you need to create your own IDataProvider. This is straight forward in first place. In your special case you like to add the feature of lazy loading (which has some quite nasty issues e.g. if a user does a fast up-down scrolling, which may cause your application to hang because of loading), and background refreshing. These features need to be implemented by your IDataProvider, like pre-loading if you scroll to a row that is not loaded yet (rows as you spoke of loading JDBC result sets) and periodical refreshes. This also applies for further functionality like sorting, filtering, grouping etc. So if you need to retrieve the data out of other layers, you need your IDataProvider to know these layers or some other ways to share this information. In E4 you could try to use context variables for example.
Hope this gives some hints in the right direction. This is really something huge and not answered easily.
Powered by FUDForum
. Page generated in 0.01570 seconds