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

RowDrop - detect drop after last row

4 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steven Bixby
Top achievements
Rank 1
Steven Bixby asked on 17 Aug 2015, 09:03 PM

I am using RadGrid's RowDrop feature to allow my users to rearrange rows in the grid.  

In the business logic, I use a table column to store a sort index for each row, and when I get a RowDrop event, I calculate the row's new index based on the target row, update the database and refresh the Datasource.  This works really well for me as long as the row is dropped on or before the last visible row in the grid.

However, my users are confused when they drop a row past the end of the last visible row and the refreshed grid shows that dropped row preceding the last row, rather than it becoming the new last row.

 How can I detect when the row is dropped in the empty space of the grid?

 I found that GridDragDropEventArgs has a member "DropPosition" which appears to be undocumented; in any case, this value (enum Above or Below) does not appear to be consistent with what non-Telerik documentation I've seen, so it's not a reliable way to detect if the user dragged past the last row or not.

 Any other ideas?

 

4 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 19 Aug 2015, 12:07 PM
Hello Steven,

I have answered your query in the support ticket you have submitted. I suggest we continue the conversation there if you have additional questions. In case the suggested approach works for you please share it in this thread. Thus, it can help someone facing similar issue.

On a side note, please avoid submitting duplicate threads. Thus, we will be able to keep better track of your support history and provide answers quicker.


Regards,
Viktor Tachev
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Steven Bixby
Top achievements
Rank 1
answered on 19 Aug 2015, 02:54 PM

The end result, which worked for me, goes like:

if (e.DestDataItem.ItemIndex == (e.DestinationTableView.Items.Count - 1)) {
 
    if (e.DropPosition == GridItemDropPosition.Above) {
        // ...
    } else {
        // ...
    }
}

 

0
William
Top achievements
Rank 1
answered on 18 May 2017, 08:11 PM
It would be great if the answer can be posted within the forum for others to see as opposed to stating it was added to a ticket.
0
Steven Bixby
Top achievements
Rank 1
answered on 18 May 2017, 08:42 PM
I did bring the answer to the forum post, see my followup.
Tags
Grid
Asked by
Steven Bixby
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Steven Bixby
Top achievements
Rank 1
William
Top achievements
Rank 1
Share this question
or