Jump to content

How to add style "content-visibility : auto" on component via code


irigsoft

Recommended Posts

Hello,

I try to add style "content-visibility : auto" for all my component created on runtime.

I use this code, but I am not sure if is work.

Is this code OK , or there is better code ?

        UniSession.AddJS('Ext.util.CSS.createStyleSheet("#' + TUniControl (MyControl).JSId + ' {content-visibility: auto; !important;}")');

 or this 

        with TUniControl (MyControl), JSInterface do begin
              JSCallGlobal('Ext.util.CSS.createStyleSheet'
                        , ['#' + JSId + ' { content-visibility: auto; !important;}'
                        , JSName + '_css1']);

       end;

 

I try to speed up rendering of components in my form based on this: https://web.dev/content-visibility/

Link to comment
Share on other sites

@Sherzod, I make it to work :

1. when create component (in Form.OnCreate event) i set :  

TUniControl (MyComponent).JSInterface.JSConfig('userCls', ['customCSSBtn']);

2. in customcss

.customCSSBtn.x-btn .x-btn-inner { 
    color: gray !important;
}
.customCSSBtn:hover {
  background-color: #ff8c00;
}

.customCSSBtn.x-pressing {
  background-color: #ee7600
}

my code is based to : 

 

  • Like 1
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...