Columns of selected datagrid object can also come from a view, so ParseTableStructure is not sufficient in both data sorting and column selection forms. Instead, just use mainform's lists which are exactly what we need. Fixes issue #1611.

This commit is contained in:
Ansgar Becker
2010-01-19 22:49:18 +00:00
parent 9f3ad6640c
commit b43b44ee5a
2 changed files with 6 additions and 20 deletions

View File

@ -35,7 +35,6 @@ type
procedure Modified;
public
{ Public declarations }
FColumns: TTableColumnList;
end;
@ -55,7 +54,6 @@ procedure TDataSortingForm.FormCreate(Sender: TObject);
begin
InheritFont(Font);
ColumnNames := TStringList.Create;
FColumns := TTableColumnList.Create;
end;
@ -65,16 +63,11 @@ end;
procedure TDataSortingForm.FormShow(Sender: TObject);
var
i: Integer;
KeysDummy: TTableKeyList;
ForeignKeysDummy: TForeignKeyList;
begin
// Take column names from listColumns and add here
KeysDummy := nil;
ForeignKeysDummy := nil;
ParseTableStructure(Mainform.SelectedTableCreateStatement, FColumns, KeysDummy, ForeignKeysDummy);
ColumnNames.Clear;
for i:=0 to FColumns.Count-1 do
ColumnNames.Add(FColumns[i].Name);
for i:=0 to Mainform.SelectedTableColumns.Count-1 do
ColumnNames.Add(Mainform.SelectedTableColumns[i].Name);
OrderColumns := Mainform.FDataGridSort;
OldOrderClause := ComposeOrderClause(OrderColumns);