Lazarus

Programming => Databases => Topic started by: daveinhull on March 05, 2019, 08:53:22 pm

Title: RxDBGrid Sort Question
Post by: daveinhull on March 05, 2019, 08:53:22 pm
Hi,

I'm trying to use the sort feature of the RxDBGrid, but it just keeps crashing.
When I look at the code it appears that the SortEngine is Nil, but I'm not sure how to set it up.

Code: Pascal  [Select][+][-]
  1. procedure TRxDBGrid.SetAutoSort(const AValue: boolean);
  2. var
  3.   S: string;
  4.   Pos: integer;
  5. begin
  6.   if FAutoSort = AValue then
  7.     exit;
  8.   FAutoSort := AValue;
  9.   if Assigned(DataSource) and Assigned(DataSource.DataSet) and
  10.     DataSource.DataSet.Active then
  11.   begin
  12.     S := DataSource.DataSet.ClassName;
  13.     if RxDBGridSortEngineList.Find(S, Pos) then
  14.       FSortEngine := RxDBGridSortEngineList.Objects[Pos] as TRxDBGridSortEngine
  15.     else
  16.       FSortEngine := nil;
  17.     FSortColumns.Clear;
  18.   end;
  19. end;          

Has anyone used this and got it working?

Thanks
Dave
TinyPortal © 2005-2018