Luciano França Posted April 18 Share Posted April 18 I have several settings that I save in my database such as font sizes, colors, etc. How could I give an update on "CustomCSS" because I realize that it is only loaded when creating the "TUniServerModule" Unit ServerModule; public { Public declarations } Procedure UpdateCSS; End; Procedure TUniServerModule.UpdateCSS; Begin With Self.customCSS Do Begin Add('.x-myfield-focus { '); Add(' border-color: #7eadd9; '); Add(' background-color: #FFFFE1; '); Add(' color: #FF0000; '); Add(' background-image: none; '); Add(' } '); End; End; //============================================================================================================ Unit Main; procedure TMainForm.UniFormCreate(Sender: TObject); begin UniServerModule.UpdateCSS; UniEdit2.JSInterface.JSConfig('focusCls', ['myfield-focus']); UniComboBox1.JSInterface.JSConfig('focusCls', ['myfield-focus']); end; Quote Link to comment Share on other sites More sharing options...
Luciano França Posted April 22 Author Share Posted April 22 Any solution ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 22 Share Posted April 22 Hello, You can use Ext.util.CSS.updateRule Like in this post for example: Quote Link to comment Share on other sites More sharing options...
Luciano França Posted April 22 Author Share Posted April 22 6 hours ago, Sherzod said: Hello, You can use Ext.util.CSS.updateRule Like in this post for example: I don't understand how this can help me. see I have appearance settings that I save in the database and I need to pass these settings to CustomCSS Can you change this attached example ? Modifed CustomCSS.7z Quote Link to comment Share on other sites More sharing options...
Luciano França Posted April 25 Author Share Posted April 25 Any alternative ? There should be a way to re-inject the delayed customCSS. Quote Link to comment Share on other sites More sharing options...
picyka Posted April 25 Share Posted April 25 Well, I believe you can use variables in CSS, and when logging into the system, set the value for these variables, or use the suggested solution ex: UniSession.AddJS('Ext.util.CSS.updateRule(''.x-btn-default-small'', ''background-color'', ''#162d3f'')'); Quote Link to comment Share on other sites More sharing options...
picyka Posted April 25 Share Posted April 25 On 4/18/2024 at 5:11 PM, Luciano França said: I have several settings that I save in my database such as font sizes, colors, etc. How could I give an update on "CustomCSS" because I realize that it is only loaded when creating the "TUniServerModule" Unit ServerModule; public { Public declarations } Procedure UpdateCSS; End; Procedure TUniServerModule.UpdateCSS; Begin With Self.customCSS Do Begin Add('.x-myfield-focus { '); Add(' border-color: #7eadd9; '); Add(' background-color: #FFFFE1; '); Add(' color: #FF0000; '); Add(' background-image: none; '); Add(' } '); End; End; //============================================================================================================ Unit Main; procedure TMainForm.UniFormCreate(Sender: TObject); begin UniServerModule.UpdateCSS; UniEdit2.JSInterface.JSConfig('focusCls', ['myfield-focus']); UniComboBox1.JSInterface.JSConfig('focusCls', ['myfield-focus']); end; UniSession.AddJS('Ext.util.CSS.updateRule(''.x-myfield-focus'', ''background-color'', ''#162d3f'')'); Quote Link to comment Share on other sites More sharing options...
Luciano França Posted April 25 Author Share Posted April 25 6 hours ago, picyka said: Well, I believe you can use variables in CSS, and when logging into the system, set the value for these variables, or use the suggested solution ex: UniSession.AddJS('Ext.util.CSS.updateRule(''.x-btn-default-small'', ''background-color'', ''#162d3f'')'); How could I put lines in this updateRule logic ? Procedure TMainForm.UniFormCreate(Sender: TObject); Begin UniSession.AddJS('Ext.util.CSS.updateRule(''.x-myfield-focus'', ''background-color'', ''#ffcccc'')'); // As ? Add('background-image: none; '); End; 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.