How to override sort mechanism of TClientDataSet

delphi, delphi-xe2, indexing, tclientdataset

Solution

You cannot override the sort mechanism of a ClientDataSet - unless you rewrite the according part of Midas.

To achieve the correct sorting (whatever logical means) you can introduce a new field and set its values in a way so that, sorted with the standard mechanism, they will give the required sort order.

Problem

Is it possible to change the way indexes are used in `TClientDataSet` to sort records? After reading this question, I thought it would be nice to be able to sort string fields logically in a client dataset. But I have no idea how to override default behavior of client dataset when it comes to indexes. Any ideas? PS: My CDS is not linked to any provider. I'm looking for a way to modify the sort mechanism of the `TClientDataSet` (or the parent in which the mechanism is implemented) itself.

Original source

Related problems