Data Grid rows reorder using drag and drop

10 posts, 0 answers
  1. loai taha
    loai taha avatar
    44 posts
    Member since:
    Apr 2007

    Posted 10 Mar 2010 Link to this post

    Hi,

    I need to know how to make it possible to reorder the rows in a single rad data grid using grid drag and drop functionality.

    I went through live examples as well as few posts in here, yet, couldn't find the solution. all what I'm looking for is to allow users to drag and drop rows to perform reordering and to show the new ordering as well.

    It's highly appreciated if you can provide code sample that demonstrate the above scenario, and please don't ask me to view live examples because I already did and couldn't find the solution!

    Thanks for your help and assistance in advance :-)

    Regards,
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 10 Mar 2010 Link to this post

    Hi,

    You've missed this example:
    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx

    Sincerely yours,
    Vlad
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. loai taha
    loai taha avatar
    44 posts
    Member since:
    Apr 2007

    Posted 10 Mar 2010 Link to this post

    Dear Vlad,

    Thanks for your fast response, however, I went through that example as well as the rest of all live examples, and that is why I needed a simple sample code, because of the complexity of the life examples.

    The scenario that I'm looking for is much simpler than that live example.

    Regards,
  5. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 15 Mar 2010 Link to this post

    Hi loai,

    For additional information on the logic behind this example, you can review the description tag. It contains all the related information on the events which are raised when dragging a row. Once you acquaint yourself with the events regarding this logic, you can handle the setup as per your requirements - if you are using a different datasource, or want to cache the data, or anything else. Regardless of these differences, the core logic/events remain the same. The client side events allow you to handle logic prior to persisting the change in the database - identify the row/target element, or cancel out the event.
    The server side event allows you to handle the actual persistence of the item in the database.
    I hope this information helps.

    Sincerely yours,
    Yavor
    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. loai taha
    loai taha avatar
    44 posts
    Member since:
    Apr 2007

    Posted 30 Mar 2010 Link to this post

    Dear Yavor,

    it's very obvious that you got me totally wrong. I know exactly when and how to use client side events.

    What I really need was a sample code that is much simpler than what you have on the live demo section, that can be applied to a single grid with a straight forward scenario (ordering rows using drag and drop only) and not an explaination about when to use client and server sides events.

    Regards,
  7. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 31 Mar 2010 Link to this post

    Hi loai,

    The example cannot actually get much more simple. It consists of two main logical parts. The first are the clientside/server side events, which are fired and facilitate the detection of the user actions. These cannot be reduced/avoided. The other part is the actual persistence of the data in the underlying database. While this can vary from setup to setup, the logic remains the same. Can you let me know which part of the logic/code is unclear, or hard to replicate at your end.

    Sincerely yours,
    Yavor
    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. loai taha
    loai taha avatar
    44 posts
    Member since:
    Apr 2007

    Posted 31 Mar 2010 Link to this post

    Hi Yavor,

    Thanks for the fast response. If you really wish to help, then please tell me if it is possible to reorder rows of RadGrid control on the client side only without persisting data in the underlying database. On the other hand, if it is possible to be done then would the re-ordered row shows in the new place at the client side without the need for a postback! i mean would rows shift up or down to accommodate the new order!

    Regards,
  9. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 01 Apr 2010 Link to this post

    Hi loai,

    Handling this setup without persisting the data to some sort of data source/medium cannot be achieved. The reason for this is that when the control is refreshed, the changes will be wiped out. Since the control does not support an unbound data mode, you will need to propagate the changes to the datasource. In most cases, this is not an expensive operation, so it will have little impact on the performance.

    All the best,
    Yavor
    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.
  10. loai taha
    loai taha avatar
    44 posts
    Member since:
    Apr 2007

    Posted 01 Apr 2010 Link to this post

    Thanks Yavor,

    This approach surely will have a great impact on performance. Let's say you have 10 rows, and for the worst case scenario, user might change the order of all the 10 rows, at that case 9-10 postbacks might be needed to perform the full ordering!... I think the best way to order a grid would be by binding its rows main field to a list box with ordering buttons enabled, upon the finish of ordering the user submits the new order and the datagrip should be updated accordingly. Tell me what you think about this approach!

    Regards :-)
  11. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 06 Apr 2010 Link to this post

    Hello loai taha,

    Indeed, the approach would have a better performance. However, at present the control does not expose any easy way to handle the functionality in such a manner. Additionally, there is no easy way to track the different states of a row. This is the reason the control exposes the present sets of events - so that each row (set of rows) is reordered immediately, and the state of the grid is refreshed, to reflect the changes.

    Sincerely yours,
    Yavor
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017