We have the need to browse several million records using the xamDataGrid and intend on loading the data into memory "on demand" using a common paging model. The problem lies with the xamDataGrid only showing scrollbars that are relevant to the current number of records on the currently-loaded 'page'.
For example, we want to load 1 million records and set a page size of 1,000 records. Our dataset is populated with 1,000 rows, and xamDataGrid shows a scrollbar to navigate those 1,000 rows. But we would like the scrollbar to act like it was scrolling the full 1,000,000 rows, if the user scrolled to 50%, it would load records 500,000 to 501,000 into memory. We are using MVVM design pattern.
Is this possible? Or will we only ever see the total number of records currently in memory represented by the scrollbar?Is it possible using XamGrid?
Sample will be great help.
Well paging is not the required solution. what i need is to virtually handle the scroll bar and only display constant number of records in the viewable records of grid. i.e, scroll bar will move according to the original count but data in the grid will be added only that is visible.
HI,
I am attaching a sample that implements paging in the XamDataGrid.
Please let me know if you need further assistance.
any solution to above problem ?
Please let me now if you need further assistance regarding this case.
You can get total records of the database you are retrieving from an SQL query. Sql Count
You can use a datatable to store the data.
If you are only going to process data by page, you could send down a list of all the keys and store this in a dictionary with the key being the page number and start and end keys of the data and a Boolean value (Got Data) to determine if the data has been retrieved form the database.
So initially get the list of all the keys, create the page dictionary – map out what keys are on each page, then get the first few pages.
Then you could build a pager control, simple control with page numbers in say a grid. When you click on a page cell, you can check the dictionary for the start and end keys using page number as key and check to see if the data had been retrieved. If it has not, then use start and end keys to retrieve the data, then update the dictionary GotData value to true. You may want to get a few pages of data each time.
If the data has been retrieved you can get the start key and retrieve the data from the datatable, then use the XamDataGrid BringItemintoview method
Here a link on http://help.infragistics.com/NetAdvantage/WPF/2013.1/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v13.1~Infragistics.Windows.DataPresenter.DataPresenterBase~BringDataItemIntoView.html