mam taki kod do sortowania danych po kliknięciu na kolumnę w obie strony, ale występuje bła porównania:
Linia:
PreviousColumnIndex := Column.Index;
Treść błędu:
[Error] Unit1.pas(427): Left side cannot be assigned to
procedure TForm1.JvDBGrid1TitleClick(Column: TColumn);
const PreviousColumnIndex : integer = -1;
{$J-}
begin
if (jvdbgrid1.DataSource.DataSet is TCustomADODataSet) and ( not column.Field.IsBlob) then
with TCustomADODataSet(jvdbgrid1.DataSource.DataSet) do begin
DisableControls;
try
jvdbgrid1.Columns[PreviousColumnIndex].title.Font.Style := jvdbgrid1.Columns[PreviousColumnIndex].title.Font.Style - [fsBold];
jvdbgrid1.Columns[PreviousColumnIndex].title.Font.Color := clWindowText;
except
end;
Column.title.Font.Style := Column.title.Font.Style + [fsBold];
Column.title.Font.Color := ClBlue;
PreviousColumnIndex := Column.Index;
if (Pos(Column.Field.FieldName, Sort) = 1) and (Pos(' DESC', Sort)= 0) then
Sort := Column.Field.FieldName + ' DESC'
else
Sort := Column.Field.FieldName + ' ASC';
EnableControls;
end;
end;
Hmm ten błąd poprawić, aby już sortowało w asc i desc?