RadGridView - Reorder rows

11 posts, 2 answers
  1. Kowal
    Kowal avatar
    14 posts
    Member since:
    Apr 2010

    Posted 29 Jun 2010 Link to this post

    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
  2. Answer
    Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 02 Jul 2010 Link to this post

    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
  3. DevCraft banner
  4. Alexey Oyun
    Alexey Oyun avatar
    74 posts
    Member since:
    Mar 2010

    Posted 12 Jul 2010 Link to this post

    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?
  5. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 12 Jul 2010 Link to this post

    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
  6. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 23 Aug 2010 Link to this post

    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.
  7. Answer
    Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 24 Aug 2010 Link to this post

    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
  8. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 25 Aug 2010 Link to this post

    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.
  9. John
    John avatar
    10 posts
    Member since:
    Jun 2009

    Posted 13 Nov 2010 Link to this post

    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
  10. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 15 Nov 2010 Link to this post

    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
  11. Serif
    Serif avatar
    3 posts
    Member since:
    Apr 2011

    Posted 09 May 2012 Link to this post

    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

  12. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 11 May 2012 Link to this post

    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 >>

Back to Top
DevCraft banner