Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I'm experimenting a sort issue with TreeList under bound mode.

                                    DataTable.DefaultView.RowFilter = "Direction = 'Incoming'";
                                    DataTable.DefaultView.Sort = "Date DESC";
                                    TreeList.DataSource = DataTable.DefaultView

                                    If user adds a row, I add the corresponding data row to the data table.
                                    If user deletes a row, I remove the corresponding data row from the data table.
                                    If user updates a row, I update the corresponding data row from the data table.

                                    Everything is fine, until...

                                    Until user clicks on a column header to sort the treelist. While the sorting looks okay, adds/deletes/updates will jump the treelist all over the places.

                                    I suspect an inconsistency between the TreeList.Sort and DataView.Sort.

                                    However, I don't know the proper approach to avoid this from happening. I couldn't find any column header clicked event, nor could I find any event arguments to bypass TreeList's default sort behavior.

                                    Please help. Thanks.

                                0

                                I found similar issues already existing in your knowledgebase.

                                However, even when I pass a regular DataView without setting "Sort" field. After user clicks on the treelist column headers, the internal indices again become unsynchronized with the dataview. This was resulting in strange behaviors of nodes jumping around the focus in your treelist view, if they are modified.

                                http://www.devexpress.com/issue=B90587
                                http://www.devexpress.com/issue=S18865

                                In addition, you mentioned that "In the future we'll try to change the TreeList behavior so it can manage data source rows based upon their key values". Has this been implemented?

                                Thank you.

                                0
                                0

                                Hi,

                                Unfortunately, we haven't made any progress regarding the TreeList should reload nodes based upon values provided by a data source key field suggestion. Please track it, to be notified about our results. I'll discuss this suggestion with our developers, and we'll consider its implementation.

                                Thank you, Marina

                                0

                                Well you didn't answer my question.

                                My question is about how to make sure that the sortings of TreeList and its underlying data source are consistent with each other.

                                My workaround is:

                                        private void ctrlBaseTreeList_EndSorting(object sender, EventArgs e)
                                        {
                                            StringBuilder sort = new StringBuilder();
                                            for (int i = 0; i < SortedColumnCount; i++)
                                            {
                                                TreeListColumn column = GetSortColumn(i);
                                                if (sort.Length != 0)
                                                    sort.Append(' ');
                                                sort.AppendFormat("{0} {1}", column.FieldName, column.SortOrder == SortOrder.Ascending ? "ASC" : "DESC");
                                            }

                                            string sortStr = sort.ToString();
                                            if (m_dataTable.DefaultView.Sort != sortStr)
                                                m_dataTable.DefaultView.Sort = sortStr;
                                        }

                                That works fine.

                                0

                                Hello,

                                >Well you didn't answer my question.
                                You have mentioned several answers, where we suggested using the SortOrder property. Sorry, I didn't think that the code snippet was necessary.

                                I've discussed that suggestion with our developers. We don't plan to implement it in the near future. We would use the TreeListControl too much, and we are not sure that it's necessary, as few users need this feature.

                                Thank you, Marina

                                0

                                >Well you didn't answer my question.
                                You have mentioned several answers, where we suggested using the SortOrder property. Sorry, I didn't think that the code snippet was necessary.

                                I've discussed that suggestion with our developers. We don't plan to implement it in the near future. We would use the TreeListControl too much, and we are not sure that it's necessary, as few users need this feature.

                                Thank you, Marina

                                -----------

                                Let me clarify, using the SortOrder property will only sort the treelist. The underlying datasource might have a different sort order. This causes treelist focus jumping around because of the sort order discrepancy.

                                As a result, I made the above code snippet. Do you agree that this is the solution?

                                Second, can you clarify that "We would use the TreeListControl too much", did you actually mean "would not"? Did you mean that not a lot of people use TreeList control and your development team is not likely to keep updating it any more?

                                0

                                >can you clarify that "We would use the TreeListControl too much", did you actually mean "would not"?
                                Yes, of course. The feature that your requested makes sense to us, and we agree that this is a good one. However, to change the current design (to take into account the DataSource sort order), it's necessary to rewrite the whole tree list logic. Our developers don't believe that it's necessary, because few users have requested this feature.

                                >Did you mean that not a lot of people use TreeList control and your development team is not likely to keep updating it any more?
                                No, we implement new features in the XtreeList. But this one is rather difficult to implement, and implementing it will harm existing stable code. In fact, we would have to change our internal logic for managing data.

                                > Do you agree that this is the solution?
                                I don't see a problem with your solution. However, we advise that you don't sort the DataSource at all. As I see, you use the View for row filtering. The TreeList itself provides advanced filtering features:
                                Filtering

                                Thank you, Marina

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners