bbm Posted November 6, 2020 Share Posted November 6, 2020 Hi, knows anybody a way to switch at runtime between ForceFit and AutoSize and back at a UniDBGrid. I need this function for example when I collapse/expand a Panel. Best regards Quote Link to comment Share on other sites More sharing options...
irigsoft Posted November 6, 2020 Share Posted November 6, 2020 29 minutes ago, bbm said: Hi, knows anybody a way to switch at runtime between ForceFit and AutoSize and back at a UniDBGrid. I need this function for example when I collapse/expand a Panel. Best regards I try to set dbgrid.forcefit to True during execution, when different requests are executed, this is my experience (but without success): when create grid: TuniDBGrid (UniMainModule.NewComponent).ForceFit := False; TuniDBGrid (UniMainModule.NewComponent)..Align = alClient; If (uniMainModule.AppPlatform <> [upDesktop]) AND StrToBoolDef (UniServerModule.SistemSettingsList.Values ['ForceFitWebGrid'],False) then TuniDBGrid (UniMainModule.NewComponent).ForceFit := True; when query executed (if setting is setted for this query): (this not work for me ) TuniDBGrid (FocusCrl).ClientEvents.ExtEvents.Values['OnReconfigure'] := ('function OnReconfigure(sender, store, colModel){ sender.headerCt.forceFit=' + AnsiLowerCase (BoolToStr (GridForceFit)) + ';}'); //OR TuniDBGrid (FocusCrl).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) { config.forceFit = ' + AnsiLowerCase (BoolToStr (GridForceFit)) + '; }'; //OR TuniDBGrid (FocusCrl).ClientEvents.ExtEvents.Values['store.load'] := 'function (sender, records, successful, eOpts) { sender.grid.columnManager.columns.forEach(function(col) { col.autoSize(); }) } '; (another try, not work for me): TryStrToBool (SettingsList.Values ['ForceFitWebGrid'],GridForceFit); SelDBGrid.ForceFit := GridForceFit; //OR SelDBGrid.ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) { config.forceFit = ' + AnsiLowerCase (BoolToStr ((strBool),True)) + '; }'; Quote Link to comment Share on other sites More sharing options...
bbm Posted November 9, 2020 Author Share Posted November 9, 2020 Hi, thank you for your support. I have now decided to design the handling differently. Nevertheless, thank you again. Best regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.