Grid view changes after sorting

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
stoffman
Newbie
Newbie
Posts: 14
Joined: Wed Dec 29, 2021 12:00 am

Grid view changes after sorting

Post by stoffman » Fri Apr 07, 2023 2:24 am

To recreate:
1. The user scrolls vertically (to the right) and put into view a column that was not first visible
2. Then sorts by this column

The grid scrolls back back to the left (the sort is being maintained)

I'm using: windows 10, Lazarus 2.2.4, Grid 1.1
Attachments
2.png
2.png (31.13 KiB) Viewed 11827 times
3.png
3.png (46.19 KiB) Viewed 11827 times
4.png
4.png (32.27 KiB) Viewed 11827 times
Last edited by stoffman on Fri Apr 07, 2023 2:27 am, edited 1 time in total.

stoffman
Newbie
Newbie
Posts: 14
Joined: Wed Dec 29, 2021 12:00 am

Re: Grid view changes after sorting

Post by stoffman » Fri Apr 07, 2023 2:25 am

Missing is the first state of the grid:
Attachments
1.png
1.png (47.8 KiB) Viewed 11826 times

Marc
Site Admin
Site Admin
Posts: 1205
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Grid view changes after sorting

Post by Marc » Fri Apr 21, 2023 12:33 pm

Hello,

Thank you for the issue report. We will look for a solution for it.

In the meantime there may be some form of workaround available using the current x and y scroll locations taken before the sort.

ie.

Code: Select all

  private
    { Private declarations }
    oldX : Single;
    oldY : Single;
You can obtain scroll positions:

Code: Select all

type
  MyScrollableControl=class(TScrollableControl);

procedure TMyForm.Button5Click(Sender: TObject);
begin
  oldX := MyScrollableControl(TeeGrid1).GetScrollX;
  oldY := MyScrollableControl(TeeGrid1).GetScrollY;
end;
Those can be restored via:

Code: Select all

  MyScrollableControl(TeeGrid1).SetScrollX(oldX);
  MyScrollableControl(TeeGrid1).SetScrollY(oldY);
If you are running the sort from a button then you could add the code in there; if not then we'll likely need to think of another way in.

Regards
Marc Meumann
Steema Support

Post Reply