populating a treeview with a lot of records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a treeview control on a windows form that I want to populate in the form's load event. The problem is that the datatable I am using to populate it contains >20,000 records, and it takes > 1 min to load the form. How can I populate it partially during load and then complete it when the user needs the complete set (i.e. when the user scrolls down)?
 
Patrick McGuire said:
I have a treeview control on a windows form that I want to populate
in the form's load event. The problem is that the datatable I am
using to populate it contains >20,000 records, and it takes > 1 min
to load the form. How can I populate it partially during load and
then complete it when the user needs the complete set (i.e. when the
user scrolls down)?

Only populate the first and second level. As soon as the user expands a node
from the first level, load the sub nodes of all sub nodes of the expanded
node.
 
A good idea, and I'm already doing that. The situation to which I'm referring, though, is one where there are > 20,000 records on the first tier

I've thought about using, say, "TOP 100", in my SelectCommand's CommandText, but how do I smoothly continue the populating when the user attempts to view more nodes by scrolling down?
 
----- Armin Zingler wrote: ----

"Only populate the first and second level. As soon as the user expands a nod
from the first level, load the sub nodes of all sub nodes of the expande
node.

A good idea, and I'm already doing that. The situation to which I'm referring, though, is one where there are > 20,000 records on the first tier

I've thought about using, say, "TOP 100", in my SelectCommand's CommandText, but how do I smoothly continue the populating when the user attempts to view more nodes by scrolling down?
 
Patrick McGuire said:
----- Armin Zingler wrote: -----

"Only populate the first and second level. As soon as the user
expands a node from the first level, load the sub nodes of all sub
nodes of the expanded
node."

A good idea, and I'm already doing that. The situation to which I'm
referring, though, is one where there are > 20,000 records on the
first tier.

I've thought about using, say, "TOP 100", in my SelectCommand's
CommandText, but how do I smoothly continue the populating when the
user attempts to view more nodes by scrolling down?


I don't know how to populate it when scrolling down, sorry. I'd say that
20,000 records is much more than a user can handle. Maybe the code to fill
the control can be optimized?
 
Group the records in some fashion *above* the top tier, perhaps
alphabetically, or by date (grouping by day, week, or month), or by using
some other suitable categorization. Your goal is to find a way reduce the
number of items in the first tier. I agree with Armin that 20,000 records is
too many to be useful, and as you can see, returning that many records
causes UI problems.

At the same time, I suggest you give users better search/filter options, so
they don't get 20,000 records back.
 
How can I populate it partially during load and then complete it when the
user needs the complete set (i.e. when the user scrolls down)?

Are you serious? Just read 50 records from the DB, and display the form.
Read the rest (and show an hourglass) when the user does something.
 
Patrick,
Would you consider an alternative to MS TreeView ?

Our TList control

a) Is much faster even if loading all records
directly into memory
( 20,000 records in under 1 SECOND ! )

b) also has a Virtual Load mechanism that triggers
an event where you can supply the data only as
needed.
Basically you tell TList how many nodes you've
got and then fill in the data when the
user scrolls, expands a branch, etc.

For such a small data set ( just 20,000 records )
I would suggest loading directly into memory.
That way you can use TList's other features for
Printing, File I/O, Search, Sort, etc.
Usually we recommend the Virtual loading only
for really large data sets - 50,000 or more
( TList can handle over a million items )


Drop me a note if this sounds interesting to you
I'd be happy to send additional information and
answer any questions you may have about TList.

* * Please include a copy of this note with your reply

Jeff Bennett
(e-mail address removed)

Bennet-Tec Information Systems, Inc
50 Jericho Tpk, Jericho, NY 11753
Phone 516 997 5596, Fax - 5597
WWW.Bennet-Tec.Com

RELIABLE Component Software
and Software Development Services
* TList/Pro * ALLText HT/Pro * MetaDraw *

====================== ======================
-----Original Message-----
From "Patrick McGuire"
 
Back
Top