TVirtualTable sorting, and disabling sorting
TVirtualTable sorting, and disabling sorting
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
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
Re: TVirtualTable sorting, and disabling sorting
Hello,
On any change of IndexFieldNames (even on setting an empty value) the dataset must be sorted again
On any change of IndexFieldNames (even on setting an empty value) the dataset must be sorted again
Re: TVirtualTable sorting, and disabling sorting
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.)
Re: TVirtualTable sorting, and disabling sorting
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).
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;
Re: TVirtualTable sorting, and disabling sorting
We will consider an opportunity to add an option for returning the old behavior in one of the next versions.
Re: TVirtualTable sorting, and disabling sorting
Hy,
I have the same problem, there are a solution now ?
Thank you.
I have the same problem, there are a solution now ?
Thank you.
Re: TVirtualTable sorting, and disabling sorting
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.
Re: TVirtualTable sorting, and disabling sorting
Ok Thank you for the reply.
But how can i use it to have the last sort instead of the original sort?
But how can i use it to have the last sort instead of the original sort?
Re: TVirtualTable sorting, and disabling sorting
We'll try to implement the original capability according to your description in the next version of our product.