Volk65 Posted March 18, 2019 Share Posted March 18, 2019 Hi all! How can I change the background color in UniHTMLMemo (dynamically created memo) ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 19, 2019 Share Posted March 19, 2019 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) +'"}' ); Quote Link to comment Share on other sites More sharing options...
x11 Posted November 12, 2021 Share Posted November 12, 2021 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? Спасибо. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 12, 2021 Share Posted November 12, 2021 1 hour ago, x11 said: Есть ли в extJS что-то готовое для преобразования из RGB в HEX? Десктопное, мобильное приложение? 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted November 13, 2021 Share Posted November 13, 2021 21 hours ago, Sherzod said: Десктопное, мобильное приложение? Приложение гибридное. Но форма мобильная. я написал чуть выше, что использую: 22 hours ago, x11 said: TunimDBListGrid Quote Link to comment Share on other sites More sharing options...
x11 Posted November 13, 2021 Share Posted November 13, 2021 up Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 15, 2021 Share Posted November 15, 2021 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' 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted November 15, 2021 Share Posted November 15, 2021 2 hours ago, Sherzod said: На стороне клиента (JS код): на стороне клиента есть только integer значение, т.е. например 65300 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 15, 2021 Share Posted November 15, 2021 9 minutes ago, x11 said: на стороне клиента есть только integer значение, т.е. например 65300 Тогда, можете просто использовать этот JS код: Ext.util.Format.hex(65300, 6); Результат: '00ff14' 1 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.