Scrolling in a virtual grid

Hello!

I created a virtual grid that first shows only the first page of 200 records (if exist) from a table.
The values are got asynchronously using a BackgroundWorker control.
In this state, I can scroll through the 200 records of the page.
After pressing a button, I actualized the number of records in the QueryRowCount event to the "real" number of records.
I expected to be able to scroll through all records, but somehow the scroll-bar remains fixed at 200, so it is impossible to see any other record.
Is it a bug or I missed something?
Thanks in advance,
Lucia

3 Replies

HA haneefm Syncfusion Team July 9, 2007 08:40 PM UTC

Hi Lucia,

Below is a forum thread that shows you "How to acheive the paging in a virtual grid?"
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=18735

If you want to scroll the grid programmatically than set TopRowIndex property to new rowIndex. Below is a code snippet

this.grid.TopRowIndex = 400;

Best regards,
Haneef


LD Lucia Diaconu July 11, 2007 10:15 AM UTC

Thanks, Haneef!
I made a few steps forward and now the scrollbar reflects the real amount of data.

But I still have a problem: I want to make the scrolling operation cancellable.
For this I use a backgroundworker to provide the info in QueryCellInfo.
I move the scrollbar from position n1 to position n2.
Then I hit a Cancel button and I want to have the grid in the same state as before starting scrolling.
For this I cancel the data provider (no need to feed data) and cancel the backgroundworker.

So, while being in QueryCellInfo, the cancellation of the backgroundworker is caught and I try to reset the grid like this:
syncGrid.Model.ResetVolatileData();
syncGrid.TopRowIndex = m_IndexFirstRowDisplayed;
syncGrid.UpdateScrollBars();
(where m_IndexFirstRowDisplayed = n1)

Instead of having the grid as it was before the scroll, I obtain a blank grid...
I think I am missing something, again.
Thanks in advance,
Lucia



HA haneefm Syncfusion Team July 11, 2007 11:24 PM UTC

Hi Lucia,

You need to handle the TopRowIndexChanging event for cancelling the up and down movement of the cellview in a grid and handle LeftColChanging event for cancelling the left to right/right movement of the cellview in a grid. Below is a code snippet

private void grid_TopRowChanging(object sender, GridRowColIndexChangingEventArgs e)
{
e.Cancel =true;
}

Best regards,
Haneef

Loader.
Up arrow icon