fabiorov Posted January 2, 2018 Share Posted January 2, 2018 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 More sharing options...
Sherzod Posted January 2, 2018 Share Posted January 2, 2018 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 More sharing options...
gastelumri Posted November 25, 2020 Share Posted November 25, 2020 Thank you @Sherzod It works at design environment How to do it on run time? Link to comment Share on other sites More sharing options...
Sherzod Posted November 25, 2020 Share Posted November 25, 2020 11 minutes ago, gastelumri said: How to do it on run time? Hide column? Link to comment Share on other sites More sharing options...
bdiri Posted November 25, 2020 Share Posted November 25, 2020 Hi gastelumri try UniDBGrid1.Columns[0].Visible:=false; UniDBGrid1.Columns[0].Menu.ColumnHideable := False; Link to comment Share on other sites More sharing options...
gastelumri Posted November 25, 2020 Share Posted November 25, 2020 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 More sharing options...
diegojmap Posted November 25, 2020 Share Posted November 25, 2020 I used DBGrid1.JSInterface.JSCall ('setVisible', [False], DBGrid1.Columns [13] .JSColumn); DBGrid1.JSInterface.JSCall ('setVisible', [False], DBGrid1.Columns [16] .JSColumn); Link to comment Share on other sites More sharing options...
gastelumri Posted November 26, 2020 Share Posted November 26, 2020 The goal is to remove the option for the end user, and have control of showing / hiding the column, without it being an end user option I will use a combination of yours codes Thank you very much gentlemen Link to comment Share on other sites More sharing options...
Pier Posted February 27, 2021 Share Posted February 27, 2021 can you please post your final code? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now