This is a migrated thread and some comments may be shown as answers.
RadGridView - Reorder rows
10 Answers 156 Views
This is a migrated thread and some comments may be shown as answers.
Kowal
Top achievements
Rank 1
Kowal asked on 29 Jun 2010, 06:09 PM
Hi,

You've provided a solution to enable row reordering in RadGridView.
I've got a couple of questions regarding this behavior.

1. Styling. I found now way to restyle a Drag Cue. There are RowReorderBehavior Style/DataTemplate (attached) properties, but they are unaccessible from associated RadGridView. RowReorderBehavior is not really a silverlight behavior, it just runs couple of methods that enable drag'n'drop in RadGridView. In your demo there are even some leftovers from your tests (testTemplate1 and testTemplate2) and you probably didn't finish this feature. Is there a way to do restyling?

2. Events. I also had a problem when I tried to reflect changes done in a view (row reorder) on my underlying model. I use MVVM pattern and I found no events that I could subscribe to to accomplish what I wanted (for example changing ID of Customers according to their order in a gridview). Can you help me?

Thank you,
Kowal

10 Answers, 1 is accepted

Sort by
0
Accepted
Yavor Georgiev
Telerik team
answered on 02 Jul 2010, 09:48 AM
Hi Kowal,

 In our Q2 release we will have built-in row reorder functionality. I suggest you try using that instead, as it is more robust and officially-supported. You can see a demo here. You can also download the beta today and try it our for yourself.

Greetings,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alexey Oyun
Top achievements
Rank 1
answered on 12 Jul 2010, 12:44 PM
Hi,

  1. In forum you had examples of row reordering with row drop indicator. That example was much better, since you can see where dropped row will be placed.
  2. Is it possible to keep reordered row as selected?
0
Yavor Georgiev
Telerik team
answered on 12 Jul 2010, 04:05 PM
Hello Alexey Oyun,

 You could try handling the DragStarted and DragEnded events on the RowReorderBehavior class in order to get the dragged and dropped object and set it to the RadGridView's SelectedItem property.

Regards,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jonx
Top achievements
Rank 2
answered on 23 Aug 2010, 02:21 PM
Hello,
I have just added the source code of your sample here:
http://demos.telerik.com/silverlight/#GridView/RowReorder
to my project.

My project is using WCF RIA Services. 

The list presented in my grid is the result from a query.

This makes that in private void OnDragInfo(object sender, DragDropEventArgs e)
IList source = gridView.ItemsSource as IList;
source is null probably because DomainDataSourceView does not implement the IList interface...

in my case gridView.ItemsSource = {System.Windows.Controls.DomainDataSourceView}

Same problem in  private void OnDropInfo(object sender, DragDropEventArgs e).

Now you made that sample work wiith basic collections. Fair enought but I need to make this work with RIA Services.

How do I get my hands on the event that tells me that the drop has ended and that gives me the source rows and the target row ?

I can see that you are doing the reorder in the OnDropInfo event of the behavior. But what I need to do is call my own code that will modify the underlying row data to set the new order, submit my changes and the reload the grid content... So I need a way to attach to an event that would provide me with the correct info, being, the draggeditems and the dropposition...

Can you help me on that please ?

Thanks a lot in advance.
John.

edit: I just see that this post is in general discutions when it would be better in the gridview section. I just did a reply to the existing post. Sorry about that.
0
Accepted
Tsvyatko
Telerik team
answered on 24 Aug 2010, 01:13 PM
Hi John,

I have prepared sample application based on the row reorder demo. It extends it by adding event DragEnded with the needed arguments, so you could use it to call the service method and refresh the data. It also restyle the drag cue.

Please have a look at it and let me know this works in your scenario.

All the best,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jonx
Top achievements
Rank 2
answered on 25 Aug 2010, 11:46 AM
Hello Tsvyatko,
Thanks a lot. This is exactly what I needed. I integrated it in my silverlight project and it's working like a charm...
Thanks for providing a working sample, it made me gain lots of time...
Sadly I cannot mark this post as an answer as I did not start the thread but then,
thanks again ;)
John.
0
John
Top achievements
Rank 1
answered on 13 Nov 2010, 05:23 PM
Hi,

Interesting sample.

Just gave it a quick run through and noticed that if you drag a row to the end it says drop after 9 but it doesn't do it. If you try to drop it before 0 that also shows you the text drop before 0 but it doesn't actually do it. 

Is there a way of having a particular column be draggable instead of allowing all columns to be the dragged?

Thanks,

John
0
Tsvyatko
Telerik team
answered on 15 Nov 2010, 03:11 PM
Hello John,

About the first question - I have modified the sample adding simple logic in the DragEnded where each individual scenario can be handled. In the sample it just reorder the rows being dragged.

About the second question - you can control columns being dragged individually using their properties properties - IsGroupable and IsReorderable. In the sample the column Name cannot be dragged.

Please, look at the example and let me know if this works for you.

Sincerely yours,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Serif
Top achievements
Rank 1
answered on 09 May 2012, 01:33 PM

Hello, 

I am using Telerik Silverlight 2011, Q3. I have a problem with RowReorder feature of RadGridView demo. I use your sample, however, it does not work with AlternationCount values bigger than 2. When setting AlternationCount, drag process happens but drop is not working properly. When I drop the row, selected row or rows are removew but they are not inserted back anymore. Any solution to this bug ?

Regards,

serif

0
Yordanka
Telerik team
answered on 11 May 2012, 08:14 AM
Hello Serif,

I couldn't reproduce the problem when AlternationCount property is set (AlternationCount="3" for example). I've used the project attached by Tsvyatko and updated it with Q3 2011 binaries. Can you try it on your side? 
 
All the best,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Asked by
Kowal
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Alexey Oyun
Top achievements
Rank 1
Jonx
Top achievements
Rank 2
Tsvyatko
Telerik team
John
Top achievements
Rank 1
Serif
Top achievements
Rank 1
Yordanka
Telerik team
Share this question
or