I want to auto-scroll through my grid every few secs. So it comes up and it displays a certain number of records. Then I want it say 10secs later to scroll past the currently visible records and to the next set.
Is that possible?
Hello Sean,
Thank you for contacting Infragistics!
You can achieve this by setting up a timer and when the timer triggers scroll the row you want into view:
www.infragistics.com/.../wingrid-scrolling-a-row-into-view
Another option would be to use the PerformAction method to simulate a PageDown.
this.ultraGrid1.PerformAction(UltraGridAction.PageDownRow);
No worries... and is there a way to count how many pages there'll be? In other words, how will I know when to stop scrolling? Will there eventually be an error, or is there a ToTheEnd type of method?
Well... I guess if your rows are all the same height - which they are by default - and the size/height of your grid isn't going to change, you could use the this.ultraGrid1.ActiveRowScrollRegion.VisibleRows.Count and compare that to the total grid.Rows.Count to determine the total number of pages. But that assumes that there are enough rows to fill a page to begin with. You will also have to play around with the calculation a bit because I think PageDown will make it so that the last visible row becomes the first visible row - so that row appears on both pages.
To determine if you are on the last page, I guess what you could do is get the last VisibleRow from the VisibleRows collection and compare that to the last row in the Rows collection. And if they are the same, you know you are at the bottom.
Frankly, though, I'm not really sure that any of this will work, because the VisibleRows collection might actually contain a couple of extra rows that are outside of the viewable area. And there are other factors to consider, like adding and removing rows, variable-height rows, special rows like the filter row, summaries, the vertical scrollbar, multiple scroll regions, scrolling within a "page", etc.
The grid is a continuous-scrolling list, it isn't intended to do paging.
Thanks Mike,
I don't have anything fancy in the grid. It's very simple with all the rows the same size. I was able to do what I needed.
Excellent.
It's tough for me to give you more specific advise because I don't know what kinds of assumptions your application can make. For example, if you know there will initially be enough rows to fill the available space in the grid, you could use the VisibleRows over the total number of rows to determine the number of pages. But if there's a chance your grid will not have enough rows to fill the available space, then that won't work. Although, I guess you can detect that case, since the VisibleRows and the total rows will be the same and you only have one page. :)
Yeah I did something very similar to that. And sometimes I'll have no data at all and that's ok. Thanks for your help.
I've got it working now and it's pretty cool. However, it would be nice to be able to set the number of rows to display at once... sort of like paging, but not necessarily.