How to make possible drag and drop rows when the SortedColumns.Count>0
regards,
pgr2007
The grid has no built-in drag and drop functionality. So you would need to write code to handle this. I don't see what SortedColumns has to do with it, although that might influence how you drop rows. But since you didn't mention what exactly you want to do when a row is dropped, I'm not sure how to answer your question.
Hi,
Thanks for the reply.
I have enabled the drag and drop feature with the code from the link
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=10086
This code works for me in ordinary case, but when I grouped the rows by a column
this.UltraGrid1.DisplayLayout.Bands[0].SortedColumns.Add("ColumnName", false, true);
This drag and drop is not working.
As I need drag and drop inside the group.
Please reply
Thanks for the reply
I tried with
aRow.ParentCollection.Move(aRow, dropIndex);
it is now working for both situation.
thanks a lot
Okay, the problem is with the call to the Move method:
ultraGrid1.Rows.Move(aRow, dropIndex);
This is assuming that the row is in the root-level rows collection of the grid. Try this instead:
aRow.ParentRowsCollection.Move(aRow, dropIndex);
I can't see any reason why dragging and dropping within the same group should not work. Is the Move method gettings called? Is it being called using the Rows collection that the row actually belongs to?
HI,
Actually I don't need drag drop outside the group.
But needed inside the group and that is not possible
The sample is using the Move method on the Rows collection. If you are trying to drag a row from one group to another, then this will not work, because the rows collection the row is currently in is not the same one you will be moving it to. The Move method can only move a row to a new position within the rows collection in which the row already exists. You can't use Move to move a row from one rows collection to another. In any case, moving a group from one group to another involves more than just moving the row. In order for the row to be moved to a new group, the value of the cell or cells that it is grouping by would have to be changed so that the row now belongs to the new group. So what you would have to do in a case like this is first change the value in the cell so that the row belongs to the new group. Then refresh the groupings on the grid to move the row to the new group. I think you can just call RefreshSortPosition on the row to handle this. Then you could call Move to position the row at the index you want it.