The Cut operations of the RadVirtualGrid does not work.
When the SelectionMode is set to FullRowSelect, MultiSelect = true, and multiple rows are selected, the loop goes something like this:
// Pseudo code:
for(int rowIndex = firstRow; rowIndex <= lastRow; rowIndex++)
{
AddRowToClipboardData(rowIndex)
UserDeletedRow(rowIndex);
}
My suggestion:
Hello Martin,
Thank you for the provided details.
Upon checking again the mentioned CSV section in the application you are right there is still a difference even after the workaround. I will also mention this in the internal backlog item so that the development team will take this into account when starts working on the item.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Dinko,
The Text-format on the clipboard is now correctly filled. The CSV-format on the clipboard is empty (it contains only the CR+LF for each row), which should contain the same values.
I think my suggestion is stel best:
Hello Martin,
Thank you for the provided details.
I was able to observe the described behavior. This behavior comes from the fact that when you perform a cut operation, the UserDeletedRow event will be called for each cut row. This approach in a multi-select scenario won't be valid. Because, when you delete a row, the event will be called on each row. The row index won't be valid at a certain point which leads to the exception. This is also the result of the second bug. When you delete a row, CellValueNeeded will be called to get the new value but this row index is already replaced with the next one in the DataTable. That is why it seems that the cut operation only gets the event values. The general approach here is to call the UserDeleteRow in a multi-select scenario when Cut/Copy operation is executed. This needs to be handled internally. Therefore I will approve the feedback item and forward this to our development team.
After trying different approaches I think I was able to find a way to delete the rows properly. I have modified the _grid_UserDeletedRow event handler. You can check the attached project. I can agree the workaround is not pretty but there were a lot of scenarios that need to be handled. For example, selecting rows at the beginning and at the end of the collection. You can try it and modified to fit your application.
As for not synchronizing the control after CUT, you were right. The grid does not consider the cut operation for an update. I have logged this in a separate feedback item on your behalf. The above approach also includes a workaround for this. You can use the DeleteRow() method of the control to force its update and delete the rows.
As a side note, the code is located in the TestForm.cs file.
I have updated your Telerik Points for both behaviors.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Here is my example code.
With this you can create multiple bugs:
Bug 1:
Bug 2:
The code:
using System.Data;
Hi Martin,
Thank you for the provided steps.
Before proceeding to the reported behavior I need to clarify the cut operation inside the RadGridView. When the user tries to cut some cells inside the control, the developer needs to handle this case to assure that the cut value is correctly transferred to the data source. What does mean? In this case, the CellValuePushed will be called in Ctrl+X key combination in which the e.Value from the event arguments will be null and need to replace the correct object value from the data source collection. Afterward, the CellValueNeeded event is triggered, where you update the grid cut cell values from the collection.
As for the reported scenario, I wasn't able to completely reproduce these behaviors. To be on the same page, may I ask you to modify my test project attached here to mimic your implementation and send it back? In the process of investigating your scenarios, I have hit different behavior with the cells not updating properly when the cut operation is executed. However, the rows are not deleted on my side nor do exceptions occur. Also, I need to see how the format is applied in your application.
I am looking forward to the updated project so I can debug it on my side.
Thank you again for your dedication in reporting this and sharing your suggestions.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.