TVirtualTable sorting, and disabling sorting

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Apparel21
Posts: 15
Joined: Mon 01 Sep 2008 01:55

TVirtualTable sorting, and disabling sorting

Post by Apparel21 » Wed 21 Sep 2016 06:22

Hi, we use the TVirtualTable, and set the IndexFieldNames property to do sorting.

In ODAC 8.5, setting the IndexFieldNames property to 'NAME' would sort the table by name. Setting the IndexFieldNames property back to '' stopped sorting, and did nothing else.

In ODAC 9.7, setting the IndexFieldNames property to 'NAME' would sort the table by name. Setting the IndexFieldNames property back to '' reverts the sort of the data back to the ORIGINAL sort order, which is not what we want.

How do we "turn off" sorting? Having IndexFieldNames set to '' used to mean no sorting, not original sorting.

To get a clearer idea of what we are trying to achieve, we want to sort the grid when the user clicks the column title, but any new entries should be appended to the end (not be sorted) until the user sorts the grid again.

Thanks in advance

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TVirtualTable sorting, and disabling sorting

Post by AlexP » Wed 21 Sep 2016 06:36

Hello,

On any change of IndexFieldNames (even on setting an empty value) the dataset must be sorted again

MarkF
Posts: 211
Joined: Thu 02 Mar 2006 14:55

Re: TVirtualTable sorting, and disabling sorting

Post by MarkF » Wed 21 Sep 2016 15:09

This change in behavior caused us serious problems as well (see my earlier posts about it.) I don't use the virtual table, but this change was made in all of the ODAC datasets a few releases ago. If you have the source code it's very easy to fix back to the old behavior (unfortunately you'll have to redo it every time a new version comes out.)

Apparel21
Posts: 15
Joined: Mon 01 Sep 2008 01:55

Re: TVirtualTable sorting, and disabling sorting

Post by Apparel21 » Thu 22 Sep 2016 01:49

Thanks for the advice; it looks like you have the same need as we do.

We've worked around it for now by reloading the data in the sorted order, so when we set it back to the default sort order, it displays the way we want it.
I think we're only getting away with it because our data is typically small, and we're just using a TVirtualTable (if it was linked to a database this would be a different story).

Code: Select all

Stream := TMemoryStream.Create;
try
  MemoryTable.SaveToStream(Stream, True, True);
  Stream.Position := 0;
  MemoryTable.Clear;
  MemoryTable.IndexFieldNames := '';
  MemoryTable.LoadFromStream(Stream, True);
finally
  Stream.Free;
end;

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TVirtualTable sorting, and disabling sorting

Post by AlexP » Mon 14 Nov 2016 12:41

We will consider an opportunity to add an option for returning the old behavior in one of the next versions.

heh
Posts: 11
Joined: Mon 04 Mar 2019 10:19

Re: TVirtualTable sorting, and disabling sorting

Post by heh » Thu 16 May 2019 09:49

Hy,

I have the same problem, there are a solution now ?

Thank you.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: TVirtualTable sorting, and disabling sorting

Post by MaximG » Fri 17 May 2019 14:32

We believe that the behavior implemented in the latest versions of our products is correct. The changes have been requested by our users. The property IndexFieldName is now fully compatible with the behavior of the standard access componets in RAD Studio, e.g. ClientDataSet.

heh
Posts: 11
Joined: Mon 04 Mar 2019 10:19

Re: TVirtualTable sorting, and disabling sorting

Post by heh » Mon 20 May 2019 06:54

Ok Thank you for the reply.

But how can i use it to have the last sort instead of the original sort?

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: TVirtualTable sorting, and disabling sorting

Post by MaximG » Fri 24 May 2019 14:49

We'll try to implement the original capability according to your description in the next version of our product.

Post Reply