Hello,
I have to fetch millions of records from SQL server and display it on xamgrid. I have read couple of months back Infragistics grid fetchs records from database and display just a page number of rows which is visible to user.
I know this is quite FAQ type question, but I am unable to find the solution. Please point me to existing article, source code or just pseudo code.
Thanks,
Mahesh
Hello Mahesh,
The XamDataPresenter family controls use some virtualization techniques, so pagination is not really needed. Only the records that are currently in view are created and the rest are not - to improve responsiveness and memory usage of the application. When new records come in view, they are created and the ones that come out of view are destroyed.
You can impelement your own pagination, by using DataPresenterCommands and BringIntoView() method, by calculating the DataRecordPresenter's height and setting the grid to the desired height - probably something like this thread
If you would like the lazy load to be performed to get records from the database, you have to implement this yourself.
Hope this helps,
Alex.
Alex,
Thanks for prompt reply. I got an idea now by seeing your reply.
One more question. Which of the following solution u suggest me about this scenario.
Problem:
I have millions of records in Database.
Solutions, I am thinking.
a) background worker thread fetch entire data from Database into local box and store it in xml file or dataset. Then display few records using BringintoView()
b) fetch records from Database as on when user scrolls to next page. That means each time I should hit DB and get records.
or u suggest any other ways Infragistrics provides (for ex: ultradatasource for wingrid) which doesn't hamper performance.
Mahesh,
I personally would use something between a) and b), but it depends very much on the scenario.
I will not fetch the entire data from the Database, but I will get a relatively big/average chunk of it, so that I would not have to fetch new records everytime the user scrolls. Of course, if the performance and the process of getting these records is fast, I would use smaller and smaller pieces of data.
For example, 1 million records - I get 100 000 and get another 100 000 with background thread when the user is scrolling to the end of the first patch.
You can see example of async data loading in the XamFeatureBrowser - Data Binding and Interaction.
Thank you so much for reply and time. I will go with your suggestion.