Using version v19.2.0.44
When SortColumnsChanged event is fired and then looping through the records, they are presented in the order before the sort and not after sort
For Each record In sfd_Documents.View.Records
docID = record.Data(0)
Next record
I have updated to v20.3.0.47 and the issue persists.
Private Sub sfd_Documents_SortColumnsChanged(ByVal sender As Object, ByVal e As SortColumnsChangedEventArgs)
For Each record In sfd_Documents.View.Records
docID = record.Data(0)
Next record
End Sub
The first record is the first record before the sort.
Hi Martin,
We have checked the reported issue with the provided details. By default, the SfDataGrid.SortColumnsChanged
event is triggered once the sorted columns get changed. At that moment the
view does not update completely that why the reported issue occurs. However,
you can achieve your requirement by using the below code snippet,
AddHandler sfDataGrid1.SortColumnsChanged, AddressOf OnSortColumnsChanged Me.sfDataGrid1.BeginInvoke(New Action(Sub() For Each record In Me.sfDataGrid1.View.Records Dim data = record.Data Next record End Sub)) End Sub |
We have prepared the sample based on your requirement. Please
have a look at this, and revert us if you have any concerns about this.
Regards,
Dhanasekar M.
If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.
Hi Dhanasekar,
Unfortunately I get the following error when inserting into my code:
Hi Martin,
We have checked the reported issue on our end. In that, the provided code snippet worked properly as expected on our end. Here we have attached the tested video demo for your reference please have a look at this. Seems it may be the compiler issue, could you please clean and rebuild the application it may resolve the reported issue. If you still facing the reported issue remove the code snippet and entered
your code snippet it manually inside the BeginInvoke method shown below,
Me.sfDataGrid1.BeginInvoke(New Action(Sub() End Sub)) |
It will resolve the reported issue. Please check and revert us if you need further assistance with this.
Regards,
Dhanasekar M.