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

TopRowIndex & TableModel.EndUpdate Causing Redraw

Hi, I''m using v3.2.1.0 of grouping grid and have added functionality to persist the current TopRowIndex and LeftColIndex between updates of grid. Basically the entire grid''s properties get recreated, ie rebuild datatable, grouping and visible columns. I set TableModel.EndUpdate(true) and then: grid.TableControl.TopRowIndex = top; grid.TableControl.LeftColIndex= left; This causes the Grid to draw itself and scroll down to the TopRow - as you''d expect I noticed that if I don''t call TableModel.EndUpdate prior setting TopRowIndex or LeftColIndex it just ignores them and stays at row 0, col 0 Are you aware of this? Is there any work around I can do? What''s the best way to wrap up loads of changes to the grid and then set EndUpdate so it only draws once? Does EndUpdate watch to see if it''s parent control is Invalid? Thanks Jason

4 Replies

AD Administrator Syncfusion Team June 9, 2005 08:23 AM UTC

This will probably not work if the records for the table are not created yet. But if everything is set up, it should work fine. Try calling int recordCount = grid.Table.Records.Count; before to see it that helps. It might also be that the SynchronizeGridWithEngine call that happens the first time the grid is displayed tries to scroll the current record into view when the grid is initially displayed. You could avoid that by setting the record to be the current element: e.g. grid.Table.DisplayElements[top].ParentRecord.SetCurrent();


JH Jason Hales June 9, 2005 03:09 PM UTC

Thanks for that, Clay. Unfortunately that doesn''t work because I don''t actually want "top" to be set as the current record. I''m tring to keep the same "viewport" even if the currenrecord is a few records out of the viewable area. Do you think grid.Table.EnsureInitialized(grid) would help to get things ready without having to first call EndUpdate? I might even try getting into QueryScrollCellInView Thanks Jason >This will probably not work if the records for the table are not created yet. But if everything is set up, it should work fine. > >Try calling > >int recordCount = grid.Table.Records.Count; > >before to see it that helps. > >It might also be that the SynchronizeGridWithEngine call that happens the first time the grid is displayed tries to scroll the current record into view when the grid is initially displayed. > >You could avoid that by setting the record to be the current element: > >e.g. >grid.Table.DisplayElements[top].ParentRecord.SetCurrent(); >


AD Administrator Syncfusion Team June 10, 2005 05:29 AM UTC

Jason, if the first call to set TopRowIndex works fine what you could do is: // optionally get record count before setting TopRowIndex to make sure records were loaded. Set the TopRowIndex. Subscribe to TableControlTopRowChanging event. Make other changes (e.g. set current record or whatever) Call Update Unsubscribe fom TableControlTopRowChanging event. In your TableControlTopRowChanging event handler set e.Inner.Cancel = true. That should prevent the grid from scrolling. Stefan >Thanks for that, Clay. > >Unfortunately that doesn''t work because I don''t actually want "top" to be set as the current record. I''m tring to keep the same "viewport" even if the currenrecord is a few records out of the viewable area. > >Do you think grid.Table.EnsureInitialized(grid) would help to get things ready without having to first call EndUpdate? > >I might even try getting into QueryScrollCellInView > >Thanks > >Jason >>This will probably not work if the records for the table are not created yet. But if everything is set up, it should work fine. >> >>Try calling >> >>int recordCount = grid.Table.Records.Count; >> >>before to see it that helps. >> >>It might also be that the SynchronizeGridWithEngine call that happens the first time the grid is displayed tries to scroll the current record into view when the grid is initially displayed. >> >>You could avoid that by setting the record to be the current element: >> >>e.g. >>grid.Table.DisplayElements[top].ParentRecord.SetCurrent(); >>


JH Jason Hales June 15, 2005 12:05 PM UTC

Hi, I still am not having any real success with this. I''m now trying: grid.TableControl.GetCurrentVScrollPixelPos() grid.TableControl.SetCurrentVScrollPixelPos(value); inside my own propery (any reason why these are functions rather than properties?) and it works a bit better - ie the screen stays exactly in the same position as before, but again setting them the first time (before calling EndUpdate) is OK but as soon as EndUpdate is called they go back to the default value (32). I have to call SetCurrentVScrollPixelPos a second time (after EndUpdate) to get the grid to scroll. I''m now thinking of capturing a bitmap of the grid and showing that to the user until all this flickering has finished. A bit OTT but it is quite annoying Thanks for your help so far Jason

Loader.
Live Chat Icon For mobile
Up arrow icon