Hello
How to order the tasks in winganttview after loading from SQL database?
Regards
Essna
Hello Essna,
Could you please let me know the exact version of Infragistics that you are using.
I modified my sample so that it can now create, save, load and delete tasks. It is still working as expected. The tasks are saved in the database in the order they were created and that is the order they are loaded into the grid. I’ve attached my sample, so you can take a look at it. On the following link you will find video, which shows how my sample works:
http://youtu.be/K-EPJxBqhbw
So I still believe that somewhere in your code, there is part that reorders the tasks and that is the reason for your issue. If you are unable to find it you could try to create a field in your database, which is filled by default with the exact time when the task was created and then to sort the tasks based on that criteria.
Please let me know if you have any additional questions.
Dimitar,
Did you read the steps to reproduce from my post. There are only two steps. Where is the first step in your video ??? How were set the tasks in database through wingantview control ? Do you think, that the loop, from your sample will works with 50 projects and 1000 tasks per project. Where are other tasks fields like AllProperties, Constraint and etc.
I tried to reproduce your issue using Volume 13.1 (13.1.20131.2079) and everything works as expected. I have a Tasks database with three entries ordered (this is the order in which I have entered those records):
-Task John
-Task Andrew
-Task Dave
When I load the tasks, they are displayed in that exact order in the UltraGanttView. Please see the following YouTube video, which shows that everything is working correctly on my machine:
http://youtu.be/MSWLzuXOV-U
It seem that your query to database reorders your data, or you have applied some sorting to GanttView. So please be sure that you are using mentioned version of Infragistics, also check your query if there is statement for ordering and your code to see if you have applied some sorting to GanttView.
Don’t hesitate to ask any additional questions you may have.
Hello Dimitar,
It is very easy to reproduce this bug. Just create 3 tasks and save it in database. Next time, when you run application and load these tasks, the order will be different. For example. I created the tasks
- Task John
- Task Andrew
- Task Dave
After loading from database, the order is:
Please provide a workaround for this bug.
Thank you
Can you please clarify the exact column/property by which you want to order your tasks, also the reason why you shouldn’t use SortedFields. If your custom order criteria is not part of the SortableTaskField enumeration you could use ICompare interface to implement your custom logic. This is very flexible way to sort your task in the exact order you want. To do that you have to set the SortedFields.Comparer property to an instance of a class which implements ICompare<Task>. After that you need to add a new sorted field with SortableTaskField.Custom:
http://help.infragistics.com/NetAdvantage/WinForms/2013.1/CLR4.0/?page=WinGanttView_WinGanttView_Sorting.html
this.ultraCalendarInfo1.Tasks.SortedFields.Comparer = new CustomComparer(); this.ultraCalendarInfo1.Tasks.SortedFields.Add(SortableTaskField.Custom, SortOrder.Ascending);
I hope this is what you are looking for.
I am waiting for your response.