Hi,
Can you please let me know if there is any default sorting of WinGrid?
I am trying to make a Drag and Drop for the following scenario: I have ONE data source and 2 WinGrids, this data source is bound to each grid, each grid have defined a column filter so each is displaying a different rows from data source.
On DragDrop event I am using 'Move' method in order to Move rows.
grid.Rows.Move(aRow, dropIndex)
however when Row is physically dropped it stays in its new place until is unselected, then its going back magically to its old place. This behawior is when I am doing Drag and Drop within one WinGrid. That's why I came to question about default sorting of WinGrid. How WinGrid is soring records if sorting criteria are not defined?
My defined options for Grid are the following - this is just in case if those setting can affect the above mentioned behaviour.
grid.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False;grid.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False;grid.DisplayLayout.Override.SelectTypeCell = SelectType.None;grid.DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect;grid.DisplayLayout.Override.SelectTypeRow = SelectType.ExtendedAutoDrag;
Another logical question would be - what is doing 'Move' method if it is not moving row?
Another question for Drag and Drop will be: How can I catch an event when Row is dropped before first or after last row in WinGrid. Shall I use grid.PointToClient method or there is any other (better) way?
Thank you for posting in our forums!
The UltraGrid doesn’t have any default sorting applied and it totally relies on the underlying data source arrangement. The Move method does exactly what’s written in its description - “moves the specified row in the row collection to the new index and the end result is that the row will be at the specified new index” which means that this method changes the index of the selected row and when the UltraGrid gets this notification, the rows are redrawn with the new order. The PointToClient is appropriate for distinguishing on which row is about to be dropped the selected row, because it gives you the UI element of the row and furthermore you can easily associate this UI element with the actual UltraGridRow object via the UI element's context. Looking through your code snippet, I assume that you implement the following knowledge base article - http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=10086
Please take a look at the attached sample application, where you can find two grids sharing the same data source and drag and drop implementation for rows following the aforementioned article. Of course let me know if you have any additional questions regarding this matter.