We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Preventing Scrolling when updating DataSource

Hi, My DataSource is a DataTable and when I update one of the rows in the table, the grouping grid control scrolls to the updated row. How do I prevent this from happening? thanks, D.

15 Replies

AD Administrator Syncfusion Team November 8, 2004 04:22 PM UTC

If I update a DataTable from a Timer tick event using this code, the groupinggrid does not move the current position.
private void timer1_Tick(object sender, System.EventArgs e)
{
	DataTable dt = this.gridGroupingControl1.DataSource as DataTable;
	int row = r.Next(dt.Rows.Count);
	int col = 1 + r.Next(dt.Columns.Count-1);
	dt.Rows[row][col] = 1000 + r.Next(100);
}
What code are you using to update your Datatable? Are you changing the CurrencyManager position somehow? If so, the groupinggrid will respond to that.


DM Dominic Morris November 9, 2004 12:38 PM UTC

Doing the updates pretty much exactly as you are, except not on a timer, but on an external event being raised. Maybe we''re using different versions, I don''t think that I''ve upgraded to the most recent version yet. Were there any code-changes around this area in the last release? I''ll try updating on a timer to see if it makes any difference. >If I update a DataTable from a Timer tick event using this code, the groupinggrid does not move the current position. >
>private void timer1_Tick(object sender, System.EventArgs e)
>{
>	DataTable dt = this.gridGroupingControl1.DataSource as DataTable;
>	int row = r.Next(dt.Rows.Count);
>	int col = 1 + r.Next(dt.Columns.Count-1);
>	dt.Rows[row][col] = 1000 + r.Next(100);
>}
>
> >What code are you using to update your Datatable? Are you changing the CurrencyManager position somehow? If so, the groupinggrid will respond to that.


DM Dominic Morris November 9, 2004 12:43 PM UTC

No, doing it on a timer makes no difference. I also removed all of my code that changes any of the default properties of the grid, to no effect. I guess you must have a different version of the control to me. Can you confirm that updates were done in this area on the last release? >Doing the updates pretty much exactly as you are, except not on a timer, but on an external event being raised. > >Maybe we''re using different versions, I don''t think that I''ve upgraded to the most recent version yet. > >Were there any code-changes around this area in the last release? > >I''ll try updating on a timer to see if it makes any difference. > >>If I update a DataTable from a Timer tick event using this code, the groupinggrid does not move the current position. >>
>>private void timer1_Tick(object sender, System.EventArgs e)
>>{
>>	DataTable dt = this.gridGroupingControl1.DataSource as DataTable;
>>	int row = r.Next(dt.Rows.Count);
>>	int col = 1 + r.Next(dt.Columns.Count-1);
>>	dt.Rows[row][col] = 1000 + r.Next(100);
>>}
>>
>> >>What code are you using to update your Datatable? Are you changing the CurrencyManager position somehow? If so, the groupinggrid will respond to that.


DM Dominic Morris November 9, 2004 12:46 PM UTC

I''m on 2.1.0.9, btw. >No, doing it on a timer makes no difference. I also removed all of my code that changes any of the default properties of the grid, to no effect. > >I guess you must have a different version of the control to me. Can you confirm that updates were done in this area on the last release? > >>Doing the updates pretty much exactly as you are, except not on a timer, but on an external event being raised. >> >>Maybe we''re using different versions, I don''t think that I''ve upgraded to the most recent version yet. >> >>Were there any code-changes around this area in the last release? >> >>I''ll try updating on a timer to see if it makes any difference. >> >>>If I update a DataTable from a Timer tick event using this code, the groupinggrid does not move the current position. >>>
>>>private void timer1_Tick(object sender, System.EventArgs e)
>>>{
>>>	DataTable dt = this.gridGroupingControl1.DataSource as DataTable;
>>>	int row = r.Next(dt.Rows.Count);
>>>	int col = 1 + r.Next(dt.Columns.Count-1);
>>>	dt.Rows[row][col] = 1000 + r.Next(100);
>>>}
>>>
>>> >>>What code are you using to update your Datatable? Are you changing the CurrencyManager position somehow? If so, the groupinggrid will respond to that.


AD Administrator Syncfusion Team November 9, 2004 03:19 PM UTC

The code I am using is 2.1.0.9 as well????? Here is the little sample I tried. Do you see this scroll when you try it? GCCSummary_4079.zip Do you have other objects using the same datasource? Is it possible that those objects might be affecting the common currencymanager position?


DM Dominic Morris November 15, 2004 07:33 AM UTC

Clay, Yes, your sample does exhibit the behaviour that I''m trying to work-around. I.e. select a cell, then hold down the vertical scrollbar and move it somewhere, watch as the grid renders the SELECTED CELL when it changes, as if the scrollbar had not been re-positioned. This only happens while the mouse button is STILL HELD DOWN. When the scrollbar is released in its new position, then the grid behaves fine.


AD Administrator Syncfusion Team November 15, 2004 08:34 AM UTC

I am still not understanding the problem. Here are 3 pictures, beforescroll, duringscroll and afterscroll. The duringscroll picture was done with the mousedown on the vertical scrollbars'' thumb during the thumb drag. Are you seeing something different, or am I missing what you are pointing out? scrolling_2667.zip


DM Dominic Morris November 15, 2004 10:52 AM UTC

Hi Clay, Yes, I believe that you are missing something! ;) 1. Select a cell (from the top row, to make it easy). 2. Start dragging the scrollbar, so that the selected cell is OFFSCREEN. 3. Watch as the grid renders the selected cell (in fact, it seems to render an entire page-worth of cells) when the value in the selected cell changes, even though it was offscreen. You must STILL HAVE THE MOUSE BUTTON HELD DOWN TO OBSERVE THIS.


AD Administrator Syncfusion Team November 15, 2004 11:56 AM UTC

Try setting this.gridGroupingControl1.InvalidateAllWhenListChanged = false; to see if this affects this behavior.


DM Dominic Morris November 15, 2004 12:48 PM UTC

I thought it had worked for a minute, but no... :( Are you able to repro it?


AD Administrator Syncfusion Team November 15, 2004 10:00 PM UTC

I can see some strange behavior is I handle the SourceListListChanged event and set e.ShouldResetCurrentRecord = false; The problem goes away if I set e.ShouldResetCurrentRecord = true;


DM Dominic Morris December 10, 2004 01:09 PM UTC

Hi Clay, I''ve re-visited your sample code, and hopefully I can now clarify the repro steps a bit better. Please note that I''ve also submitted this via direct-trac. This issue is now top-priority for us, as until it''s resolved, it will stop us using the control in our app. REPRO: 1. Run your sample app, then click into a cell to select it, so that it appears with a thin black border. 2. Hit the command button to start the timer. 3. Scroll the grid using the mouse, either using the mousewheel, or by clicking in the vertical scrollbar. This should be sufficient to reproduce the defect. HOWEVER, what I now realize that I previously had not, is that as soon as any cell on the same row as the selected cell gets updated, the selected cell loses its "selected" status, i.e. it does not appear with the black border. As soon as this has happened, then the defect does not manifest itself. Because of the random nature of the timer, this could happen straight away (so you''d never see the strange scrolling bug), or it could take a long time (so you''d see the bug for quite a while). If it does happen, then simply click into a cell, in order to get the black border, and then use the mouse to scroll. While the cell has the black border drawn around it, then scrolling doesn''t work. Could you confirm that you''re able to reproduce this behaviour? We''ve tried it on multiple machines now, all produce the same effect. Many thanks, DM. >I can see some strange behavior is I handle the SourceListListChanged event and set e.ShouldResetCurrentRecord = false; > >The problem goes away if I set e.ShouldResetCurrentRecord = true; > >


AD Administrator Syncfusion Team December 10, 2004 05:43 PM UTC

Hi Dominic, we can see the behavior. we will make changes to our code so that the grid will not scroll to the current cell when records in the underlying list are changed from outside. It will be fixed for the final 3.0 version. Stefan


DM Dominic Morris December 13, 2004 06:09 AM UTC

Fantastic, thanks Stefan. Do you have a release date for 3.0? Would it be possible to get hold a pre-release version that addresses this problem? We are commited to releasing our software to our UAT users within a couple of weeks from now, and I''d rather not have to write a hack to workaround this bug... Thanks again, DM. >Hi Dominic, > >we can see the behavior. > >we will make changes to our code so that the grid will not scroll to the current cell when records in the underlying list are changed from outside. It will be fixed for the final 3.0 version. > >Stefan >


AD Administrator Syncfusion Team December 13, 2004 06:57 AM UTC

Our announced release date for 3.0 is Dec 16.

Loader.
Live Chat Icon For mobile
Up arrow icon