Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 377
  • Last Modified:

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

0
Bianca
Asked:
Bianca
1 Solution
 
Geert GruwezOracle dbaCommented:
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
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
What about set Column.options.sorting => false?
This should disable the column sorting leaving the table sorted just by the dataset index (if present)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now