Columns wwDataGrid

Comments

4 comments

  • Michael Verhagen

    I encounter the same result but in a slightly different situation, but I think that my work-around might work for you.

    When I configure the grid in the IDE, the datasource has references to all of the fields that the grid can display.

    At run-time, I make sure the queries also include all of those fields.  Then, I selectively add to the grid only those fields that are desired at that time.

    Maybe the following code will give you an idea that works for you.

          grdAttachment.Selected.Clear;
          if UserCanSeeAttachmentLocation then
             begin
             grdAttachment.Selected.Add('file_drive'#9'4'#9'Drive~letter'#9'F');
             grdAttachment.Selected.Add('file_server'#9'11'#9'Server~name'#9'F');
             grdAttachment.Selected.Add('file_path'#9'22'#9'File path'#9'F');
             grdAttachment.Selected.Add('file_name'#9'35'#9'File name'#9'F');
             grdAttachment.Selected.Add('original_path_and_filename'#9'50'#9'Original path and filename~(for the user who attached the file)'#9'F');
             grdAttachment.FixedCols := 4;
             pnlAttachmentLocation.Visible := True;
             end
          else
             begin
             grdAttachment.Selected.Add('file_name'#9'60'#9'File name'#9'F');
             grdAttachment.Selected.Add('original_path_and_filename'#9'40'#9'Original path and filename~(for the user who attached the file)'#9'F');
             grdAttachment.FixedCols := 1;
             pnlAttachmentLocation.Visible := False;
             end;
          grdAttachment.Selected.Add('remark'#9'16'#9'Remark'#9'F');
          grdAttachment.Selected.Add('updated_by_logon_name'#9'12'#9'Updated by'#9'F');
          grdAttachment.Selected.Add('updated_on'#9'18'#9'Updated~on'#9'F');
          grdAttachment.Selected.Add('created_by_logon_name'#9'12'#9'Created by'#9'F');
          grdAttachment.Selected.Add('created_on'#9'18'#9'Created~on'#9'F');
          grdAttachment.Selected.Add('performance_test_request_id'#9'6'#9'Req~ID'#9'F');
          grdAttachment.Selected.Add('inactive_flag'#9'6'#9'Inactive'#9'F');
          grdAttachment.Selected.Add('inactive_on'#9'11'#9'Inactive~on'#9'F');
          grdAttachment.Selected.Add('id'#9'6'#9'ID'#9'F');
          grdAttachment.ApplySelected;
    0
    Comment actions Permalink
  • Erik Fidlers

    Thanks for this work around. It'll indeed work when you clear the columns and then recreate them but why is it working whithout this when you open the datasource the first time and not the second time? I think Roy can help us to have it working in the future withhout this workaround.

    0
    Comment actions Permalink
  • Roy Woll

    I think Michael is using InfoPower, so his solution would not apply to FirePower's TwwDataGrid. I'm also not sure how to reproduce your problem. I don't know if it would help, but you could try calling the method Columns.BeginUpdate before you change your visible property, and then Columns.EndUpdate afterwards.

    Also if you can create a reproducable case you can email me that would help me figure out your issue.

     

    0
    Comment actions Permalink
  • Michael Verhagen

    Yes, I had been looking at FMX apps but then didn't catch it when I found something similar in a VCL app and failed to notice the switch to VCL.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk