Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS FMX UI Pack
How to sort a TMSFMXLiveGrid by clicking the header of a column

A data-bound TTMSFMXLiveGrid does not support sorting directly, therefore sorting needs to be applied on the dataset itself. To have the desired effect you need to implement the OnCanSortColumn and return Allow := False, then manually sort the dataset which will automatically update the grid and show the values in the sorted order. Changing a value on a sorted dataset will update the value accordingly.

example:

procedure TfrmMain.TMSFMXGrid1CanSortColumn(Sender: TObject; ACol: Integer;
  var Allow: Boolean);
begin
  Allow := false;
//sort on dataset level
end;