Jump to content

Hide (really) columns in DBGrid


fabiorov

Recommended Posts

Hi

 

Usually I need to hide columns to the user (because it has some DB tables key values that are not recommended  to show), so I do:

Dbgrid.columns[x].visible:=False;

The problem is that user can go to the upper tittle bar of DBgrid and enable them, so is there a final method to not allow the user to enable the not-visible columns?

 

 

Link to comment
Share on other sites

Hi,

 

You can use like this, for example:

 

Hidden column index = 0

 

1. Columns[0].Visible := False;

 

2. UniDBGrid -> ClientEvents -> ExtEvents -> function reconfigure:

function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)
{
    columns[0].hideable=false;
}

Best regards,

Link to comment
Share on other sites

  • 2 years later...
1 hour ago, bdiri said:

UniDBGrid1.Columns[0].Visible:=false;
UniDBGrid1.Columns[0].Menu.ColumnHideable := False;

May work, but will need the part that is set on IDE (UniDBGrid -> ClientEvents -> ExtEvents -> function reconfigure)

 

4 hours ago, Sherzod said:

Hide column?

Yes, hide the column, something like the below code

procedure TMainForm.UniBitBtn1Click(Sender: TObject);
begin
  UniDBGrid1.ClientEvents.Enabled:=false;
  UniDBGrid1.ClientEvents.ExtEvents.Clear;
  UniDBGrid1.ClientEvents.Enabled:=true;
  UniDBGrid1.ClientEvents.ExtEvents.Values['reconfigure']:=
     'function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) ' +
     ' { columns[0].hideable=false; }';

  //UniDBGrid1.ClientEvents.ExtEvents.Values['activate']:= 'function activate(sender, eOpts) { }';
end;

 

Link to comment
Share on other sites

  • 3 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...