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

Multiple Dynamic Grids Drag and Drop

3 Answers 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Drew Auman
Top achievements
Rank 1
Drew Auman asked on 11 Jul 2011, 09:22 PM
I am looking to create grids dynamically from a database that have drag and drop row ability within the grids themselves, however prevent them from dragging and dropping outside of their parent grid.   I also want to keep performance in mind as well ...

User 1
    Project 1
    Project 2
    Project 3
  
User 2
    Project 4
    Project 5
    Project 6

User 3
    Project X
    Project Y
    Project Z

As shown above, users would be pulled from a database with the grid below them containing the projects that they are working on with the ability to drag and drop sort the order of the projects......  The project row would contain several columns with data relating to the project.  As a example, Project 5 could be moved above or below it's current position, however it could never be moved to User 1 through the drag and drop grid....

The Big Question:  Is this possible, and how would this be accomplished?  Any examples provided would be great....

Drew

3 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 14 Jul 2011, 01:03 PM
Hello Drew,

In order to implement the desired functionality, I recommend that you cancel the RowDropping client-side event if the dragged row is dropped in another tableview:
function onRowDropping(sender, args) {
    if (args.get_draggedItems()[0].get_parent() != args.get_targetItemTableView()) {
        args.set_cancel(true);
    }
}

I hope this helps.

All the best,
Mira
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Drew Auman
Top achievements
Rank 1
answered on 14 Jul 2011, 01:42 PM
Ok sounds good.  So in terms of creating the grids, what would your recommendation be?

Would I place a RadGrid on the page for the users and them within each row place another rad grid for the projects? 

What about post back?  I assume I will need to rebuild all data sets for the page for each drag and drop reorder ?  Or is there a way to just hit the database for the grid that is currently being reordered?

Thanks for your help
Drew
0
Mira
Telerik team
answered on 14 Jul 2011, 03:05 PM
Hello Drew,

I suggest that you use an hierarchical grid for representing the data.

About the reordering:
If you want to store the changed order in the database, please follow this code library.
Otherwise, you can store the data from the database in a List, set it as a datasource of the grid and reorder the items only in it. This approach is implemented in the Items Drag-and-drop demo.

I hope this helps.

Kind regards,
Mira
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Drew Auman
Top achievements
Rank 1
Answers by
Mira
Telerik team
Drew Auman
Top achievements
Rank 1
Share this question
or