Hello,
There is a issue with the latest version. LiveBindings handling with FixedRow is problematic when you want to sort a grid having fixedrow > 1. Actually, sortering is always done on the 1st row. Sortering should be done on the header row.
Thank you
Hi,
Pieter,
It looks like this worked on previous version.
How can I implement this ? I really want to have the same build-in functions of the grid (marquee to see sort status, working with groups...)
thank you
After applying sorting, the LiveBindings connection still references the same order therefore editing rows will edit the incorrect unsorted row index. If it worked previously then it this is most likely a grid that hasn't been edited as sorting only sorts the internal data of the grid, and not the data fetched from the dataset. Please understand that proper sorting needs to be performed on dataset level, and not on grid level.
Hello Pieter,
I have multiple issues with this version :
Grid is set this way :
- binded to data via livebindings
- FixedFooterRow set to 1
- FixedRow set to 2
As you can see, fixed footer row is filled with data. I expect it to be empty. Fixed footer row is also filled when sorting, filtering...
Sorting handling is not behaving as I expect and don't provide a nice user experience :
- I need to click on row 0 to sort data. It should be row 1.
- Green sorting triangle are displayed on row 0, on my merged cell. It should be row 1.
In regards to "OnCanSortColumn", here is the used code :
procedure TfrmMain.grCAClientCanSortColumn(Sender: TObject; ACol: Integer;
var Allow: Boolean);
begin
if ACol = 0 then exit;
Allow := false;
dtmMain.fdmtCAClient.IndexFieldNames := lgDSCAClient.Columns[ACol-1].MemberName;
grCAClient.SortColumn := Acol;
end;
Is their a way to know if columns is sorted ASC or DESC ? I need this info for my dataset to be correctly sorted (FireDAC)
Thank you
Hi,
This is the code used to sort the Dataset.
fdmtCAClient is an TFDMemTable
lgDSCAClient is an TLinkGridToDatasource
grCAClient is an TTMSFMXGRid
procedure TfrmMain.grCAClientCanSortColumn(Sender: TObject; ACol: Integer;
var Allow: Boolean);
begin
if ACol = 0 then
exit;
Allow := false;
if grCAClient.SortDirection = sdDescending then
begin
grCAClient.SortData(ACol,sdAscending);
dtmMain.fdmtCAClient.IndexFieldNames := lgDSCAClient.Columns[ACol - 1].MemberName + ':A';
end
else
begin
grCAClient.SortData(ACol,sdDescending);
dtmMain.fdmtCAClient.IndexFieldNames := lgDSCAClient.Columns[ACol - 1].MemberName + ':D';
end;
end;
Did you reinitialize the bindings after updating the grid? or are you binding everything programmatically?
I din't reinitialize the bindings after updating the grid. What should I exactly do ?
I did used the "Livebinding designer" and linked fields (one by one, not using *) from bindingdatasource to the tmsfmxgrid.
My grid is v2.2.6.0 and don't have TMSFMXGrid1.Options.Sorting.Row(neither published or public scope)
My TMS Firemonkey pack is 3.2.7.2
You should clear the bindings and then re-initialize them and see if that fixes the issue. If the issue persists, then you can try to force the FixedRows and FixedFooterRows at runtime, before opening the dataset. The Options.Sorting.Row property has just been added as an improvement, but still needs to be released. In the next version you will be able to use this property to choose a row of choice for sorting.Pieter Scheldeman2016-03-02 09:53:56
I was able to reproduce this.
In design time, no problems, fixed footer row isn't filled.
A run time, I'm loading data from a REST service : fixed footer row is filled.
I've forced the FixedRows and FixedFooterRows at runtime, before opening the dataset but the problem persists.
I can send you a project ?
We received & handled your test project.