This is a migrated thread and some comments may be shown as answers.

Drag&Drop in Group (GridView)

3 Answers 31 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lukas
Top achievements
Rank 1
Lukas asked on 11 Oct 2012, 10:06 AM
Hey!

I implemented the Drag&Drop for row reordering according to the documentation. However, I noticed that reordering only works properly, if I don't group. In this post you mention, that I need a special property for ordering. I already have this property in my model (int SortIndex).

But how do I tell the Drag&Drop Manager or the GridView, which property it should manipulate and use for ordering within groups?

(A litle detail: The GridView displays invoice positions, that are grouped by date. All invoice positions have a SortIndex property (int), that I intended to use for sorting.)

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 11 Oct 2012, 10:39 AM
Hi Lukas,

In that case you need to modify the SortIndex property of your business objects. Ideally you will be able to rearange items within the groups. You need to do this when you drop the item upon the GridView, so you can do the changes in the SortIndices. 
Note however that the behavior you are creating is highly custom and depends entirely on your own custom implementation. 

Hope this helps! 

All the best,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Lukas
Top achievements
Rank 1
answered on 14 Oct 2012, 03:34 PM
I tried to do what you said but the code from the documentation is very "intricate" ;). I also noticed I expressed myself poorly in the question...

The behaviour I want to have is, that you can drag items from one group to another. The order inside a group is irrelevant (this is standardized and taken care of at another place). I just need to pick up an item from one group, and deposit it in another. Then I just call a function on the ViewModel that does the group-internal sort.

How can I do that?
0
Accepted
Nick
Telerik team
answered on 15 Oct 2012, 06:56 AM
Hi Lukas,

Moving an Item from one group to another relies on changing the value of the property in that Item that the GridView is grouped by. I. e. If you have a group with a value of 7, and you want to drag an item from that group in another one with a value of lets say 6, the only way to do so is to change the items property value to 6. This automatically means that you cannot reorder items in groups other than the ones that are depending on the sort index property, which is your own custom approach to the scenario, which means that the whole logic depends solely on changing the values of that property.  

Hope this makes sense! 

Kind regards,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Lukas
Top achievements
Rank 1
Answers by
Nick
Telerik team
Lukas
Top achievements
Rank 1
Share this question
or