Hi all
Short version of my problem:
i have a Datagrid (Flexgrid from ComponentOne) with a Datatable as
source. I need to search a row in the datatable, using a primary key
column in the datatable, and then figure out wich row this currently
is in the Datagrid. This should probably be done using the currency
manager for speed reasons.
For the live of me, i can't figure out how to locate the row very fast
in the Datagrid. Everybody is just talking about finding a record in
the datatable corresponding to a row on the datagrid, so the other way
arround.
Some explanations:
Speed is a primary concern. This Datagrid is very dynamic. It can
contain several thousand records (worst case) and several 100 updates
or even 1000 updates a second can trickle in. Those updates need to be
visualized with colors on the grid. The amount of records in the grid
can change very often. also, the user can sort the 2 douzen or so
columns.
Simply scanning thru the grid (using Search function of the grid),
searching for the right key is no option because only about 50 records/
sec can be located like this.
The only solution i have right now is filling a Hashtable with Key and
Datagrid RowID every time the amount of records in the grid change or
the user changes sorting. Then using the Hashtable to locate the row.
About 30000 rows a second can be located like this. Fast enough. But
it's not very elegant and error prone. And it's possible that changes
on the grid happen very often, negating the speed advantage of the
Hashtable.
I found out, that locating a record on the Datatable is just as fast
as in Hashtable, 30000recs/s (in a 5000recs Datatable). Also, if i
change some cell/col value in the Datatable, this change is immediatly
shown in the grid, no matter how the grid is sorted. Locating and
changing a value can be done almost 20000 times a second. Hence, there
IS a way to locate the row in the grid very fast. probably using
currency manager.
It would be great if someone could help me. Thanks for any hints!
Greets
Beat