Sherzod Posted October 14, 2020 Share Posted October 14, 2020 3 minutes ago, x11 said: FormControl.JSInterface.JSAddListener('pained', 'togglePainted'); Первое, что я заметил: 'pained', должно быть painted Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 14, 2020 Share Posted October 14, 2020 И попробуйте перенести код в событие UnimFormCreate. Quote Link to comment Share on other sites More sharing options...
x11 Posted October 14, 2020 Author Share Posted October 14, 2020 Исправил. Все равно нет иконок. И нет <p> Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 14, 2020 Share Posted October 14, 2020 10 minutes ago, Sherzod said: И попробуйте перенести код в событие UnimFormCreate. ? Quote Link to comment Share on other sites More sharing options...
x11 Posted October 15, 2020 Author Share Posted October 15, 2020 Я имел ввиду, что я перенес код в onCreate и все равно нет иконок. А важно ли то, что первым будет в очереди? процедура загрузки "function window.beforeInit" или FormControl.JSInterface.JSAddListener('pained', 'togglePainted'); FormControl.JSInterface.JSConfig('IconFileName', [IconFileName]); т.е. в каком порядке правильно загружать? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 15, 2020 Share Posted October 15, 2020 Добрый день, 10 minutes ago, x11 said: FormControl.JSInterface.JSAddListener('pained', 'togglePainted'); Пожалуйста, также замените pained на painted Quote Link to comment Share on other sites More sharing options...
x11 Posted October 15, 2020 Author Share Posted October 15, 2020 да, это я в первую очередь исправил. спасибо что заметили. 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted October 15, 2020 Author Share Posted October 15, 2020 вот что заметил, ошибка Uncaught TypeError: sender.setLabel is not a function function window.beforeInit(sender, config) { createToolTip = function(combo, tip) { combo.labelTip = Ext.create('Ext.tip.ToolTip', { closable: true, align: 'tl', focusOnToFront: true, autoHide: true, autoShow: true, autoScroll: true }); combo.labelElement.addListener('click', function(e) { e.preventDefault(); if (combo.labelTip) { if (combo.getPlaceholder()) { combo.labelTip.setHtml(combo.getPlaceholder()); } else { combo.labelTip.setHtml(tip); } combo.labelTip.showByTarget(combo.inputElement); } }); }; window.togglePainted = function() { var me = this; if (me.IconFileName) { var svgHeight = me.element.getHeight() - 30; sender.setLabel('<p class="svgIconLabel"><img class="svgIcon" height="' + svgHeight + 'px" src="files/svg/' + me.IconFileName + '"></img>' + me._label + '</p>'); } }; } Quote Link to comment Share on other sites More sharing options...
x11 Posted October 15, 2020 Author Share Posted October 15, 2020 вот так получилось sender.setLabel я исправил на me.setLabel function window.beforeInit(sender, config) { createToolTip = function(combo, tip) { combo.labelTip = Ext.create('Ext.tip.ToolTip', { closable: true, align: 'tl', focusOnToFront: true, autoHide: true, autoShow: true, autoScroll: true }); combo.labelElement.addListener('click', function(e) { e.preventDefault(); if (combo.labelTip) { if (combo.getPlaceholder()) { combo.labelTip.setHtml(combo.getPlaceholder()); } else { combo.labelTip.setHtml(tip); } combo.labelTip.showByTarget(combo.inputElement); } }); }; window.togglePainted = function() { var me = this; if (me.IconFileName) { var svgHeight = me.element.getHeight() - 30; me.setLabel('<p class="svgIconLabel"><img class="svgIcon" height="' + svgHeight + 'px" src="files/svg/' + me.IconFileName + '"></img>' + me._label + '</p>'); } }; } 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 15, 2020 Share Posted October 15, 2020 9 minutes ago, x11 said: sender.setLabel я исправил на me.setLabel Да, все правильно! Quote Link to comment Share on other sites More sharing options...
Fred Montier Posted December 11, 2020 Share Posted December 11, 2020 This works only with mobile platform ? See "painted" event not in desktop. How make it work in desktop controls like edits and combos ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 11, 2020 Share Posted December 11, 2020 Just now, Fred Montier said: See "painted" event not in desktop. "afterrender" Quote Link to comment Share on other sites More sharing options...
Fred Montier Posted December 11, 2020 Share Posted December 11, 2020 UnimToggle1.JSInterface.JSAddListener('painted', 'togglePainted'); Just change to ? Will try... formControl.JSInterface.JSAddListener('afterrender', 'togglePainted'); Quote Link to comment Share on other sites More sharing options...
Fred Montier Posted December 11, 2020 Share Posted December 11, 2020 I'm adapting a previous procedure to make use of FieldLabel with font awesome Quote Link to comment Share on other sites More sharing options...
x11 Posted December 8, 2021 Author Share Posted December 8, 2021 On 10/14/2020 at 7:02 PM, Sherzod said: Попробуйте это решение: возникла небольшая проблема... свойство _label содержит не название, а весь HTML, поэтому на форме выводится иконка дважды Подскажите, что использовать вместо me._label? Спасибо. Quote Link to comment Share on other sites More sharing options...
x11 Posted December 8, 2021 Author Share Posted December 8, 2021 т.е. получается ,что вот этот кусок лишний не могу понять, откуда он берется Quote Link to comment Share on other sites More sharing options...
x11 Posted December 8, 2021 Author Share Posted December 8, 2021 30 minutes ago, x11 said: me._label Заменил на me.initialConfig.label, лишний HTML исчез. Правда, не знаю, правильно это или нет. 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.