Jump to content

Switch between ForceFit and AutoSize at UniDBGrid


bbm

Recommended Posts

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)) + '; }';
 

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