Jump to content

UniHTMLMemo - background


Volk65

Recommended Posts

17 hours ago, Volk65 said:

How can I change the background color in UniHTMLMemo (dynamically created memo) ?

Hi,

You can try to use this approach:

1. 

Uses ... UniGUIJSUtils;

2. For example:

  with UniHTMLMemo1 do
    JSInterface.JSAddListener('initialize', 'function(editor){'+
                              'const bodyArea = editor.getEditorBody();'+
                              'bodyArea.style["background-color"] = "'+ uniColor2Web(Color) +'"}'
    );

 

Link to comment
Share on other sites

  • 2 years later...
On 3/19/2019 at 7:40 AM, Sherzod said:
uniColor2Web(Color)

 

Подскажите, а как такое сделать в шаблоне XTamplate (мобильная версия)? Т.е. не на бэкэнде. А сам шаблон для TunimDBListGrid находится в файле.

function beforeInit(sender, config){
...
...
'<td style="background-color:{[this.getColor(values)]};" colspan="3">{[this.getVal(values, "FULL_TYPE")]} </td>' +
...
...
...

getColor: function(vals){
						if (sender.fieldsNames.indexOf("COLOR")){
							
							//в поле "COLOR" находится int значение, т.е. RGB
							return (vals[sender.fieldsNames.indexOf("COLOR")]);//как получить '#00ff00'
							}
					},

Есть ли в extJS что-то готовое для преобразования из RGB в HEX?

Спасибо.

Link to comment
Share on other sites

21 hours ago, Sherzod said:

Десктопное, мобильное приложение?

Приложение гибридное. Но форма мобильная.

я написал чуть выше, что использую:

22 hours ago, x11 said:

TunimDBListGrid

 

Link to comment
Share on other sites

On 11/12/2021 at 7:07 PM, x11 said:

Есть ли в extJS что-то готовое для преобразования из RGB в HEX?

Десктоп:

initialization
  ...
  UniAddJSLibrary('build/packages/ux/classic/ux.js', False, [upoFolderJS, upoPlatformDesktop]);

Мобильный:

initialization
  ...
  UniAddJSLibrary('build/packages/ux/modern/ux.js', False, [upoFolderJS, upoPlatformMobile]);

На стороне клиента (JS код):

Ext.ux.colorpick.ColorUtils.rgb2hex(255,255,255);

Результат:

'FFFFFF'

 

  • Thanks 1
Link to comment
Share on other sites

9 minutes ago, x11 said:

на стороне клиента есть только integer значение, т.е. например 65300

Тогда, можете просто использовать этот JS код:

Ext.util.Format.hex(65300, 6);

Результат:

'00ff14'

 

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