TableControl_MouseMove find collection record of row below the mouse

Hi,

I used as base the example to highlight the row when the mous is moving over and I would like to match the record associated to the row that is at the mouse pointer.

There is a snapshot of the code (I removed not relevant checks regarding the row index.


private void TableControl_MouseMove(object sender, MouseEventArgs e)
{
    var rowColumnIndex = this.mainSfDataGrid.TableControl.PointToCellRowColumnIndex(this.mainSfDataGrid.TableControl.PointToClient(Cursor.Position));

m_hoveredRowFullPath = m_docCollection.DocDetails[this.mainSfDataGrid.TableControl.ResolveToRecordIndex(
rowColumnIndex.RowIndex)].FullPath.ToString();
}


This works and I get the correct record, but once I change the sorting I do not get anymore the correct record.
There should be something I did not catch about the correlation of the collection index and the table control.

Can you help me to find the correct record matching the row below the mouse pointer?


Thanks a lot.



3 Replies 1 reply marked as answer

MA Manikanda Akash Munisamy Syncfusion Team November 20, 2024 05:22 PM UTC

Hi Daniele Wyss,

Thank you for bringing this to our attention. We have reviewed your scenario regarding the requirement to highlight a row when the mouse hovers over it in the SfDataGrid. Based on the details provided, we understand that the functionality is working as expected under normal circumstances but fails to retrieve the correct record after a sorting operation.

To investigate this further, we attempted to replicate the issue using a simple sample application. However, in our tests, the records were retrieved correctly, even after sorting. For your reference, we have attached the sample application used in our testing.

To help us identify the root cause of the issue and provide an accurate solution, we kindly request the following:
  1. If possible, please modify the attached sample to replicate the issue so that we can analyze it in our environment.
  2. Provide additional details about how the row is being highlighted using the m_hoveredRowFullPath property.
  3. Any images or videos demonstrating the issue would be highly beneficial for us to understand the scenario better.

If we have misunderstood your request or if your requirements differ, please do not hesitate to provide further clarification. We are committed to assisting you in resolving this issue effectively.

We appreciate your cooperation and look forward to your response.

Regards,
Manikanda Akash M

Attachment: SfDataGrid_Demo_d25ab6dc.zip

Marked as answer

DW Daniele Wyss November 20, 2024 09:27 PM UTC

Hi,

I corrected my example with your example steps and now it is working.


Thanks you very much for your very efficient and good support!



MA Manikanda Akash Munisamy Syncfusion Team November 21, 2024 12:20 PM UTC

Hi Daniele Wyss,

We are pleased to know that your requirement has been met. This forum will now be marked as solved. For further queries, feel free to create a new forum.

Regards,
Manikanda Akash


Loader.
Up arrow icon