New row hidden
Hello
I have an SfDataGrid in which I load thousands of records and obviously not all of them are displayed.
If I add a new record, I'd like to position over it and to do that I use the ScrollInView method.
The record is selected correctly but remains hidden.
Some more scrolling is needed to make it visible.
Basically, the ScrollInView positions itself correctly on the record but scrolls only to the second to last record and therefore the last one remains hidden.
So, how can I make the newly added record visible immediately at the end of the list?
In addition I may have also encountered a bug.
When I select the first record, as RecordIndex I get returned the value -1.
Which seems strange to me.
Attached is the test project
Regards
Michele
Attachment: TestSfDataGridSolution_612b052.zip
Hi Michele,
We have analyzed the sample you have provided. The record collection consists of rows, excluding the header row. The RowIndex has the index value that includes the header row. We have modified the sample by assigning the RecordIndex property with the last index of the record collection and we calculate the index value for the RowIndex property by using the ResolveToRowIndex method, by passing the recordIndex. Please find the code snippet below,
|
//Getting the index of the last item of the record collection and assigned it to the RecordIndex property. var recordIndex = records.IndexOf(item); RecordIndex = recordIndex;
//Then calculating the RowIndex by passing the record index. var rowIndex = Grid.ResolveToRowIndex(recordIndex); RowIndex = rowIndex; |
We have modified the sample you have provided, please find it in the attachment.
Regards,
Sreemon Premkumar M.
Attachment: TestSfDataGridSolution_96f2c72a.zip
Thanks Sreemon
It works
Regards
Michele
Michele ,
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊.
- 3 Replies
- 3 Participants
- Marked answer
-
MI Michele
- Jul 12, 2023 09:44 AM UTC
- Jul 17, 2023 01:37 PM UTC