I'm using a UltraWinGrid binding to UltraDataSource with the LoadOnDemand-Feature and the HeaderClickAction.ExternalSortSingle Setting.The Grid contains about 150 columns and up to 40000 rows. Therefore we load the data in an asynchronous manner with portions of 50 models.
As the Sorting should not be done by the Grid (it would load the data completely which will be avoided using LoadOnDemand) the Modellist must be sorted before adding a row to the UltraDataSource for each model in the list.
The workflow is:- Load first 50 objects into a ModelList- Sorting the List - Adding 50 rows to the Datasource with each containing the model as tag- Setting the DataSource to UltraWinGrid- Loading next 50 objects- Adding it to the ModelList (now containing 100 models)- Sorting it again- Adding the new rows to the Datasource (already binded to the UltraGrid)
Problems:=> the Rows will not be added in the correct sort order as it will be added at the end of the DataSource=> after loading all 40000 Models, I got a ModelList with 40000 models and have to sort it completey again, which makes the asynchronous loading useless.
Questions:- How can I add each portion of 50 Models in a sorted manner to the DataSource, without causing the UltraWinGrid loading all the grid rows due to sorting?
- Do you have any other idea how to load the 40000 datarows sorted into the UltraGrid with high Performance?
Your help will be really appreciated!!
You lost me a little bit when you got to the workflow here. If you load 50 records and then sort them, doesn't that present a problem when you load the next 50 records? Because the next 50 records might be interspersed with the original 50. So the user isn't really getting the first 50 records in order, they are essentially get 50 records at random and then sorting them.
Perhaps there is some factor about your applicaiton that I am missing, but that seems like very strange UI to me. It seems to me that the user would expect to get the first 50 records already sorted, so you would have to sort all 40,000 records initially and the load the first 50 after the sort is complete.
thanks for your quick answer!
Yes you're right. It is a problem just to sort the first 50 models in the list, then add it to the Datasource and fill the UltraGridRows with the Data. This result is only temporary, correct. Additionally the next 50 models are unsorted again, have to be added to the already sorted ModelList and therefore the list has to be sorted again completely.
The problem is, I can't (better: the user will not) wait, until 40,000 records are loaded as this will last to long. Therefore we decided to load the data in portions of 50 records, sort them, and present them as soon as possible in the UltraGrid. So the user can see the first results, while the rest of the data is loading in the background.
Then the rest of the data has to be added to the UltraGrid sorted as well. (But if the UltraGrid does the sorting, it will load all the data of the 40,000 rows and that will last too long. Therefore we decided to choose ExternalSortSingle (and LoadOnDemand) and have to sort the Modellist before adding it to the DataSource.)How can we manage this ( perhaps by adding each new row sorted to the UltraGrid) without freezing the UltraGrid?
Or I try to ask the question in another way:
There are 40,000 rows with 120 columns to be loaded sorted in the UltraWinGrid. Loading 40,000 rows from Database and serializing it to the Client will take some time, so the data is loaded asynchronously in portions by 50 rows.
What is the best way to show the results as fast as possible in the UltraWinGrid? (LoadOnDemand is already used)
Hope, I could better describe the problem now.
I don't see any reasonable way to do this.
What I would do is present the user with some sort of filtering criteria and let them load a subset of the data based on that. That way the user can load the records they are interested in at any given time.
A grid with 40,000 rows in it would be of limited use to a user, anyway, even if they only load up 50 at a time. What are the odds that the ones the user actually wants are the first 50 loaded? It seems to me that no user can reasonably be expected to deal with a grid with 40,000 rows in it. It would be more useful for the user to specify some criteria that describes what records he is looking for and then to only present a sub-set of the data at any time.
thanks that you answered again.
We have already search profiles which the user can define by himself, providing filtering criteria for a search. But very often, the result will be really many rows, up to 10,000 or more. Sure, we recommend the user to define the search profile in such a way to get smaller and more detailed results. Anyway, our application should be able to handle huge results in a reasonable performance time.
So your first answer provides the trigger, to discuss again the way of selecting the rows from database. We should use the sort criteria to select the rows from Database already sorted, then load and serialize them to the client (regarding good performance), then use the UltraGrid with LoadOnDemand.
Thanks again for your ideas. I really appreciate your answers and tips to all the other UltraWinGrid issues in this forum!