User (Old forums)MemberAugust 18, 2004 at 5:30 pmPost count: 23064
Has anyone experienced the following and found a workaround:
I have a grid which can have up to several hundreds rows at a time. The application in which I use it supports an auto-refresh of the data displayed in the grid. The refresh rate can be quite fast, like every 5 seconds. The problem is that when the refresh occurs (of the dataset bound to the grid) the grid seems to totally redraw itself and the scrollbar resizes/moves around. So if a user is scrolling down looking for a row and a refresh occurs, the scrollbar leaves their grip and things move around. I have determined that this only occurs when the values of a sorted column are modified.
Currently, I save and set the FirsVisibleRow property before and after the refresh so that at least the rows go back to approximately where the user was when scrolling. It is still very sloppy looking and frustrating to have it redraw (and the scrollbar move around) though.
What I would like to do:
1) it would be great if someone knew a way to simply keep things from going so haywire while the update was occurring. I’ve tried suspending the layout on the grid but that didn’t seem to have any affect.
2) Simply only allow sorting when the user clicks on the column header. When first populated it would sort and then I’d like to turn off sorting. Once a user clicks on a column header, I would sort the grid, then turn sorting off. This way, things will run just great and will only change when the user intentionally changes/updates the sort. The *problem* is that I don’t kow how to trap for mouse events (click, mouseup, mousedown, etc) in the column header. Does anyone have an idea on how to do that?
Imported from legacy forums. Posted by superqd (had 4101 views)User (Old forums)MemberAugust 19, 2004 at 2:40 amPost count: 23064
Just before updating the grid, call grid.BeginInit(); after updating the grid, call grid.EndInit();
That might solve the problem of the scrollbars jumping around, and it might speed up the refresh a lot.
// update grid
Imported from legacy forums. Posted by Tommy (had 285 views)User (Old forums)MemberJanuary 4, 2007 at 2:59 pmPost count: 23064
Can you possibly elaborate on this? Specifically, the functionality of SaveFirstVisibleRow and LoadFirstVisibleRow?
Imported from legacy forums. Posted by Kelly (had 380 views)User (Old forums)MemberJanuary 10, 2007 at 10:21 amPost count: 23064
It probably refers to a user defined method in which the FirstVisibleRow gets saved, and then reloaded after the grid is updated.
Imported from legacy forums. Posted by André (had 308 views)User (Old forums)MemberJanuary 10, 2007 at 11:01 amPost count: 23064
I sent you a reply this week regarding how I ‘fixed’ this issue. However, I’ve since noticed that I can reset the main grid, but if a detail grid jumps on update (which they do) I don’t appear to have an accessible property for detail grid objects called FirstVisibleColumn which means I have no means with which to reset it. Any suggestions?
Ref: Case 102022
Imported from legacy forums. Posted by Kelly (had 524 views)
- You must be logged in to reply to this topic.