473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Locating a Datagrid Row from the Datasource Row, FAST

Ty
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
Apr 7 '08 #1
4 2259
You just want to find if the row is there and/or display the data? Try a
DataView and set a RowFilter on it.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"Ty" <ty********@gmail.comwrote in message
news:cf**********************************@a70g2000 hsh.googlegroups.com...
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

Apr 7 '08 #2
Ty
Hi

no, first i need to locate the record in the datatable, then change
some values in some columns (wich then automatically changes the
values in the datagrid). then i change the background-color of the row
or the cell in the grid, to indicate the change for the user. the user
always sees all the current records.
what i'm really looking for is how to get directly from datatable row
to datagrid row. this must be stored somewhere, since the grid updates
correctly and very fast when i make updates in the datatable, no
matter how the grid is sorted or even filtered. this must somehow be
done using the currency manager. i think it would be a very simple and
fast solution, if i could only find it...
i've tried using the DefaultView of the Datatable, sorted by the Key,
this works, but only as long as the user doesn't sort by some other
field.
in my desperation i even called up Microsoft asking for technical
support. The only support they have is opening a troubleticket and
paying 480$ up front. and then you don't know, when the problem will
be solved...

if someone knows a really good support hotline or chat for .net, let
me know too.

so, pleeaaaze help :)

On 7 Apr., 15:29, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamMwrote:
You just want to find if the row is there and/or display the data? Try a
DataView and set a RowFilter on it.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my bloghttp://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************" Ty" <tylersh...@gmail.comwrote in message

news:cf**********************************@a70g2000 hsh.googlegroups.com...
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.
Apr 7 '08 #3
On Apr 7, 9:16*am, Ty <tylersh...@gmail.comwrote:
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.
Well, 30k of rows is a HUGE amount, you should only load thoe you are
going to show, I recommend you to use some paging in the server.

Also you should first post in the forums of the grid you are using,
maybe there is a faster, or recommended way of doing this.
Apr 7 '08 #4
Ty
Hi,

it's not 30000 records. i'm testing the worst case wich MAY be 5000
records. using hashtable or datatable can locate 30000 records each
second in a 5000 records table. usual would be a couple hundert
records in the grid/table and a couple hundert searches/updates per
second. it depends on the user. and it's a windows application and not
a web application.

the whole application (potentially a douzen forms on screen,
distributed on several screens) is very performance critical. data has
to be shown in realtime on different forms and comes in streaming from
a dataprovider. so even if the slower methods would do for 99% of the
cases in this form, i need to spare cpu ressources where ever i can
for other interactive forms. slow execution=lot of cpu time.

i did check on the forum of the grid. there are 2 or 3 questions
exactly for this but no satisfying answer. one possible solution was
to fill a hashtable with key and gridrow index (was nice to see that i
wasn't that far off with my hashtable solution :)). but it's not
really efficient since i would have to change the hashtable with every
change of sort or amount of records in the datagrid/datatable.

it's also about having a clean solution, going the shortest way
possible. the rowindex information must be directly available,
somewhere, since data updates are very fast in the datagrid when
changes on the underlying datatable are made. i don't like going the
"ah well, it's working" route when i know/suspect that there is a
faster, cleaner, more logical and ultimately easier to maintain way
to do it.
Thanks

Beat
On 7 Apr., 16:59, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac...@gmail.comwrote:
On Apr 7, 9:16*am, Ty <tylersh...@gmail.comwrote:
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.

Well, 30k of rows is a HUGE amount, you should only load thoe you are
going to show, I recommend you to use some paging in the server.

Also you should first post in the forums of the grid *you are using,
maybe there is a faster, or recommended way of doing this.
Apr 7 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
5
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. ...
3
by: Kevin Pedersen | last post by:
Hello, I am using an editable datagrid. After I save the changes the datagrid shows the old values. I've read the posts about the Page_Load and not binding the datagrid each time. The SQL that...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
1
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
1
by: KC | last post by:
How can I set a newly created DataGrid object equal to a particular DataGrid in my app? I'm loading data from a file and one of the things the file contains is the name of the datagrid used to view...
9
by: John Hernry | last post by:
I have been watching the dotnet newsgroups for a couple of weeks now and scouring the net looking for a solution to my datagrid find functionality. With no luck. I am hoping that you can help me....
8
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.