Link to home
Start Free TrialLog in
Avatar of Norm-al
Norm-alFlag for United States of America

asked on

how to clear sort on this code snippet

I have a special function that sorts a dataset in a grid by picking either by Week, Month, Year. It works great but it forces a sort order on the results, but I don't want to sort by this field. How can I clear the sorting?
procedure TfrmWIPReport.GroupThisColumnByMonth1Click(Sender: TObject);
var
  I: Integer;
  CurrentView: TcxGridDBTableView;
begin
  inherited;
  CurrentView:= TcxGridDBTableView(Level1.GridView);
  I := CurrentView.Columns[HitColumn].GroupIndex;
  CurrentView.Columns[HitColumn].GroupIndex := -1;
  CurrentView.Items[HitColumn].Tag := 2;
  CurrentView.Columns[HitColumn].HeaderGlyph := nil;
  imgLstSortGlyphs.GetBitmap(CurrentView.Items[HitColumn].Tag,CurrentView.Columns[HitColumn].HeaderGlyph);
  CurrentView.Columns[HitColumn].GroupIndex := I;
  CurrentView.DataController.Refresh;
  CurrentView.ViewData.Collapse(true);
//  CurrentView.DataController.DataSet.Refresh;
end;

Open in new window

Avatar of Geert G
Geert G
Flag of Belgium image

group by requires a sort
that's the basis of grouping a set of data

what does your data look like ?

maybe you can add a pseudo sort column that does what you need
ASKER CERTIFIED SOLUTION
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial