Jump to content

Hiding UniDbGrid Columns


MOGSY

Recommended Posts

Hi

How is possible to hide columns in UniDbGrid? I have tried the following and is not working.

         for II := 0 to unidbgrid.Columns.Count - 1 do begin
          if (unidbgrid.Columns.Items[II].FieldName = 'ABC') or (unidbgrid.Columns.Items[II].FieldName = 'EFG') then
            unidbgrid.Columns.Items[II].Visible := True
          else
            unidbgrid.Columns.Items[II].Visible := True;
         end;

Thanks

Link to comment
Share on other sites

I Use this to create and setup Columns:

 

          MyColumn := TuniDBGrid (SelDBGrid).Columns.Add;
          MyColumn.Font.Size := uniMainModule.ControlsFontSize;
          MyColumn.Title.Font.Size := uniMainModule.ControlsFontSize;
          MyColumn.Title.Alignment := taCenter;
          MyColumn.Title.Caption := FieldsData [0];
          MyColumn.Sortable := True;
          MyColumn.ReadOnly := True;
          MyColumn.ShowSummary := True;

          ------- --- this is it ------------------------
          IF FieldsData.Count > 1 then begin
              if FieldsData [1] > '-1' then
                  MyColumn.Width := StrToInt (FieldsData [1])
              else MyColumn.Visible := False;
          end;

 

I use file with settings for every grid and dinamically create it. If Lenght in file is biger of 0 then set up a column width from file else hide column.

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...