1

I've noticed that when you have multi-select on in a TDBGrid, have a number of rows selected and delete a record, the record is deleted just fine, but your selection changes below the deleted record. All the rows move up one, but the selection stays in the same location - thus the selection effectively moves down by one record.

Is there an easy way of preserving the selection in a grid when a deletion occurs (or somehow fixing the behavior of the grid)?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Alister
  • 6,527
  • 4
  • 46
  • 70
  • 1
    Deleting all selected records and clearing the selection would be the logical thing to do IMO. Question is valid though, +1. – Sertac Akyuz Aug 08 '14 at 00:25
  • @SertacAkyuz Yup, that is what I usually do, however I have another screen that can delete records in the main grid – Alister Aug 08 '14 at 01:50
  • 3
    It looks like the behavior you are seeing is from the dataset. The selection is just some bookmarks on the dataset. IMHO, your best bet would be to get the selected records before the deletion, delete the records and then reselect the records in question. – Graymatter Aug 08 '14 at 01:58

0 Answers0