Jump to content

UniDBGrid - в Runtime не включается группировка


dbf_usr

Recommended Posts

UniDBGrid - в Runtime не включается группировка.

Если на момент запуска приложения группировка не была включена -то включить ее вовремя выполнения программы не получается - она не включается. Так же ее нельзя отключить если она была включена.

procedure TUniPrices.UniComboBox1Change(Sender: TObject);
begin
 if UniComboBox1.ItemIndex=0 then
   begin
    UniDBGrid1.Grouping.Enabled:=false;
   end;
 if UniComboBox1.ItemIndex=1 then
   begin
    UniDBGrid1.Grouping.FieldName:= 'type_price';
    UniMainModule.PgPrices.IndexFieldNames := 'type_price';
    UniDBGrid1.Refresh;   //showmessage('Group by Day');
    UniDBGrid1.Grouping.Enabled:=true;
   end;
 if UniComboBox1.ItemIndex=0 then
   begin
    UniDBGrid1.Grouping.FieldName:= 'Product_name';
    UniMainModule.PgPrices.IndexFieldNames := 'Product_name';
    UniDBGrid1.Refresh;   //showmessage('Group by Day');
    UniDBGrid1.Grouping.Enabled:=true;
   end;
end;

procedure TUniPrices.UniDBGrid1ColumnSort(Column: TUniDBGridColumn;
  Direction: Boolean);
begin
if UniComboBox1.ItemIndex=0 then
 begin
   UniDBGrid1.Grouping.FieldName:= '';
   if SameText(Column.FieldName, '') then
       UniMainModule.PgPrices.IndexFieldNames := '';
 end;
 if UniComboBox1.ItemIndex=1 then
 begin
   UniDBGrid1.Grouping.FieldName:= 'type_price';
   if SameText(Column.FieldName, 'type_price') then
       UniMainModule.PgPrices.IndexFieldNames := 'type_price';
 end;
 if UniComboBox1.ItemIndex=2 then
 begin
   UniDBGrid1.Grouping.FieldName:= 'Product_name';
   if SameText(Column.FieldName, 'Product_name') then
       UniMainModule.PgPrices.IndexFieldNames := 'Product_name';
 end;
end;

Что посоветуете?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...