How do i scroll to the top row ? We have grid that is dynamically updated whenever a new records appear i want the grid to scroll at top most row (the grid is sorted by id in descending order so new record will always appear in top)
I treid with currencymanager.position =0 but i don''t see grid scrolling to the top row then i implemented this code
this.Binder.CurrentPosition=0;
this.ScrollCellInView(1,1);
but now i see a painting problem ? any clue..
AD
Administrator
Syncfusion Team
March 11, 2005 07:28 PM UTC
Try setting this.grid.TopRowIndex = 1;
AD
Administrator
Syncfusion Team
March 11, 2005 07:33 PM UTC
i tried that but the arrow pointer which is the column 0 in this case doesn''t point to top row...i still see the ">" pointer displayed on previous selected row not on new row.
>How do i scroll to the top row ? We have grid that is dynamically updated whenever a new records appear i want the grid to scroll at top most row (the grid is sorted by id in descending order so new record will always appear in top)
>
>I treid with currencymanager.position =0 but i don''t see grid scrolling to the top row then i implemented this code
> this.Binder.CurrentPosition=0;
> this.ScrollCellInView(1,1);
>
>but now i see a painting problem ? any clue..
AD
Administrator
Syncfusion Team
March 11, 2005 07:45 PM UTC
Also use this.grid.Binder.CurrentPosition = 0;
AD
Administrator
Syncfusion Team
March 11, 2005 07:46 PM UTC
If you also want to move the current cell, also use grid.CurrentCell.MoveTo(1,1);
AD
Administrator
Syncfusion Team
March 11, 2005 07:53 PM UTC
pls find attached bitmap which describes the current behaviour.. we have created our dervied class that extends griddataboudn
as u can see the following code is inserted in this class
private void Model_RowsInserted(object sender, GridRangeInsertedEventArgs e)
{
if ( this.Model.RowCount == 1 )
{
this.Model.ColWidths.ResizeToFit(GridRangeInfo.Table());
}
if (this.Binder.CurrentRowIndex == 2 || this.Binder.CurrentRowIndex == 1)
{
this.TopRowIndex=1;
this.CurrentCell.MoveTo(1,1);
}
}
now we see a painting problem... (note : i cannot uplaod the bitmap because the upload window is taking hell lot of time to appear)
for example if the grid contains following rows
ID Trader Name
3 AA
2 BB
1 CC
and when new records appear the grid will look like as describe dbelow.
ID Trader Name
3 AA
3 AA
2 BB
1 CC
but now when i go and click on any of the cells of the first two rows redraw happesn properly
ID Trader Name
4 DD
3 AA
2 BB
1 CC
Also there is a code in PreparviewStyleinfo which does some coloring stuff.. but nothing major ...
Hope this explains a bit
AD
Administrator
Syncfusion Team
March 11, 2005 08:19 PM UTC
If you can send a sample project showing teh problem to suppaort@syncfusion.com, we can try to spot the problem here.
Something else to try:
this.Binder.EndEdit();
this.TopRowIndex=1;
this.CurrentCell.MoveTo(1,1);
this.Refresh();