Page 1 of 1

When sorting, the size of all the columns changes and the gr

Posted: Wed Jun 06, 2018 5:51 pm
by 18683216
Delphi version: Seattle
TTeeGrid version: VCL & FMX Registered version-1.05
Multidevice Application (FMX)
Platform: WIN32

I have attached your demo (Unit_Custom_Sorting.pas/fmx) with an added column of type integer so that you can reproduce the behavior.

The following happens, if you click on any of the three columns everything works as expected.

The unexpected behavior occurs when in the new column "id" the focus is placed in some cell of that column and click on the header of the column "id", to change the order.

At that time the width of all columns grows to a size that does not fit in the grid and the grid becomes unmanageable.

This behavior I have only observed in columns that contain numbers. that's why I added the id column as integer.

PD:
I also attached an example in TEE_GRID.zip and Lib_GridEx, with TVirtualFDDatasetData a descendant of TVirtualDBData, to facilitate the ordering of a TFDDataSet (The demo.xml file is not included, if you wish, request it and send it to you in separate mail.)

Re: When sorting, the size of all the columns changes and the gr

Posted: Fri Jun 08, 2018 11:47 am
by 18683216
Good afternoon Yeray,

I have been able to observe that in certain occasions in the call to Tee.GridData.DB.TVirtualDBData.AutoWidth (), it resulted: = APainter.TextWidth ('0') * tmpL; returns unexpectedly high values (eg 199990,15625) and therefore the grid is not able to display the columns correctly.

This happens, when doing tests, I change TeeGrid.Data to assign another datasource, and coincidentally the focus is in a numeric cell.
It also occurs when the sort is enabled and the column button is pressed and the focus is in a numeric cell.

The first time TeeGrid.Data is assigned, the data is displayed correctly.

I suspect that the problem may have to do with the alignment on the right.

Saludos

Re: When sorting, the size of all the columns changes and the gr

Posted: Fri Jun 08, 2018 11:54 am
by 18683216
I attached images of the appearance before and after the problem.

Re: When sorting, the size of all the columns changes and the gr

Posted: Tue Jun 12, 2018 8:24 am
by yeray
Hello,
REH Outsourcing wrote:I have attached your demo (Unit_Custom_Sorting.pas/fmx) with an added column of type integer so that you can reproduce the behavior.

The following happens, if you click on any of the three columns everything works as expected.

The unexpected behavior occurs when in the new column "id" the focus is placed in some cell of that column and click on the header of the column "id", to change the order.

At that time the width of all columns grows to a size that does not fit in the grid and the grid becomes unmanageable.

This behavior I have only observed in columns that contain numbers. that's why I added the id column as integer.
I can reproduce this problem with Seattle, but not with Berlin/Tokyo:
2018-06-12_10-17-55.gif
2018-06-12_10-17-55.gif (61.71 KiB) Viewed 56147 times

Re: When sorting, the size of all the columns changes and the gr

Posted: Tue Jun 12, 2018 11:03 am
by 18683216
Good morning Yeray,

I confirm that the problem is specific to FMX:WIN32 Seattle, when compiling the demonstration project in Tokyo it works correctly.
It is evident that in Seattle there must be some kind of problem, which causes the width of columns to change.

I attach the simplified test project plus the data.

Additionally I observe the following:
.- When TTeeGrid.Editing.AlwaysVisible, the editor is shown but it is not editable, when it is false, it can be edited without problems. (FMX:WIN32: Seattle & Tokyo)
.- TTeeGrid.Editing.Editing.EnterKey = NextCell, is not taken into account, after pressing Enter, the newly edited cell loses focus, but the focus does not go to the next cell, or to any other (FMX:WIN32 Seattle & Tokyo)

Re: When sorting, the size of all the columns changes and the gr

Posted: Tue Jun 12, 2018 12:05 pm
by yeray
Hello,
REH Outsourcing wrote:I confirm that the problem is specific to FMX:WIN32 Seattle, when compiling the demonstration project in Tokyo it works correctly.
It is evident that in Seattle there must be some kind of problem, which causes the width of columns to change.
The only workaround I can think on right now is to set the "id" column to be aligned to the Left, in Seattle:

Code: Select all

  TeeGrid1.Columns[2].TextAlignment:=TColumnTextAlign.Custom;
  TeeGrid1.Columns[2].TextAlign.Horizontal:=THorizontalAlign.Left;

Re: When sorting, the size of all the columns changes and the gr

Posted: Tue Jun 12, 2018 4:02 pm
by 18683216
Thanks Yeray, at the moment that workaround serves me.

Re: When sorting, the size of all the columns changes and the gr

Posted: Mon Jul 09, 2018 5:22 pm
by 18683216
You can see an alternative solution, in this post, "Problem with the order when you have to scroll with a column"

Re: When sorting, the size of all the columns changes and the gr

Posted: Wed Jan 27, 2021 8:34 pm
by 18690545
olá sou novo por aqui, gostaria de saber se a um meio de ordenar as colunas sem precisar de código.

Re: When sorting, the size of all the columns changes and the gr

Posted: Wed Feb 03, 2021 2:00 pm
by yeray
Hello,
olá sou novo por aqui, gostaria de saber se a um meio de ordenar as colunas sem precisar de código.
There's no editor option to sort columns for the moment so I'm afraid the only way to achieve it with code.