x11 Posted August 18, 2020 Share Posted August 18, 2020 How to add FieldLabel click event for unimDBLookupComboBox or unimSpinner or unimEdit? on server app procedure TfmMoboli1.unimEdit1tAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin .... end; thanx Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 18, 2020 Share Posted August 18, 2020 24 minutes ago, x11 said: How to add FieldLabel click event for unimDBLookupComboBox or unimSpinner or unimEdit? Hi, One possible solution: function afterCreate(sender) { sender.labelElement.addListener('click', function() { ajaxRequest(sender, ....) }); } 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted August 18, 2020 Author Share Posted August 18, 2020 Когда нажимаешь первый раз, то появляется ошибка: c is not constructor. А потом проблем нет. Но если перезапустить приложение в браузере (F5), то снова при первом тапе по FieldLabel появляется ошибка. вот мой код function afterCreate(sender) { sender.labelElement.addListener('click', function() { ajaxRequest(sender, ["LabelFieldClick"]) }); } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 18, 2020 Share Posted August 18, 2020 8 minutes ago, x11 said: Когда нажимаешь первый раз, то появляется ошибка: c is not constructor. Я не смог воспроизвести ошибку... Quote Link to comment Share on other sites More sharing options...
x11 Posted August 18, 2020 Author Share Posted August 18, 2020 у вас мобильное приложение? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 18, 2020 Share Posted August 18, 2020 Проверяю на "десктопном"... Quote Link to comment Share on other sites More sharing options...
x11 Posted August 18, 2020 Author Share Posted August 18, 2020 сделайте на мобильном Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 19, 2020 Share Posted August 19, 2020 18 hours ago, x11 said: сделайте на мобильном Работает без ошибок. Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 Да, действительно. Извиняюсь, что ввел в заблуждение, это у меня проблема - я неправильно вызывал ShowMessage() в событии unimEdit1tAjaxEvent. Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 Но все равно есть ещё маленькая проблема. Если нажимать на FieldLabel у unimDBLookupComboBox`а, то вдобавок выпадает ещё и список, как будто я нажал на сам список, а не на FieldLabel. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 19, 2020 Share Posted August 19, 2020 25 minutes ago, x11 said: Но все равно есть ещё маленькая проблема. Если нажимать на FieldLabel у unimDBLookupComboBox`а, то вдобавок выпадает ещё и список, как будто я нажал на сам список, а не на FieldLabel. Попробуйте так: function afterCreate(sender) { sender.labelElement.addListener('click', function(e) { e.preventDefault(); ajaxRequest(sender, ...); }); } 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 Спасибо. Получилось. Хотелось бы поиметь свойство EmptyText у unimDBLookupComboBox. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 19, 2020 Share Posted August 19, 2020 6 minutes ago, x11 said: Хотелось бы поиметь свойство EmptyText у unimDBLookupComboBox. Использовать этот конфиг?: Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 Возвращаемся. там же, последний пост - вопрос "А как получить placeholder при нажатии на кнопку или в моем случае при нажатии на иконку?" т.е. мне нужно не только записывать значение в "placeholder", но и читать потом это значение. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 19, 2020 Share Posted August 19, 2020 Я кажется не очень понимаю Ваш случай. Т.е., placeholder - это же readonly значение... Где Вы хотите читать значение?! Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 2 minutes ago, Sherzod said: placeholder - это же readonly значение... Странно, если бы это свойство было только для чтения, то его бы не удалось изменить, но этот код изменяет значение: UnimDBLookupComboBox1.JSInterface.JSConfig('placeholder', ['какой-то текст для описания']); Но вопрос другой: как прочитать это значение. Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 7 minutes ago, Sherzod said: Где Вы хотите читать значение?! Я хочу его читать при нажатии на кнопку или при нажатии на FieldLabel, вот здесь я описал - зачем это нужно Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 19, 2020 Share Posted August 19, 2020 2 minutes ago, x11 said: если бы это свойство было только для чтения Я имел в виду другое... Ок 3 minutes ago, x11 said: Но вопрос другой: как прочитать это значение. На клиентской стороне? Если да, то можете использовать: sender.getPlaceholder(); sender.setPlaceholder("val"); Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 4 minutes ago, Sherzod said: На клиентской стороне? Можно и на клиентской тогда как поменять эту функцию (событие) function afterCreate(sender) { sender.labelElement.addListener('click', function(e) { e.preventDefault(); ajaxRequest(sender, ...); }); } Чтобы вместо ajaxRequest() отображался некий ToolTip с тем текстом, который находится в placeholder? Я так подразумеваю, что нужно копать в эту сторону, но я пока ещё не достаточно хорошо знаю, как применять код extJS в uniGUI. Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 В десктопном варианте приложения ToolTip (Hint) - это всплывающая подсказка при наведении мышки на элемент. Но в мобильном варианте нет мышки. Поэтому приходится выдумывать что-то. Вот я и придумал - нажимать на FieldLabel и отображать ToolTip, а в тексте всплывающей подсказки ToolTip показывать значение из PlaceHolder. Подскажите, как это сделать. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 19, 2020 Share Posted August 19, 2020 3 minutes ago, x11 said: Подскажите, как это сделать. Да, тут вариантов много. Сейчас попробуем... Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 что-то вроде: function afterCreate(sender) { var s = sender.getPlaceholder(); sender.tip.ToolTip({ target: sender, html: s }); } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 19, 2020 Share Posted August 19, 2020 function afterCreate(sender) { sender.labelTip = Ext.create('Ext.tip.ToolTip', { target: sender.inputElement, //html: , align: 't', autoShow: true, autoScroll: true, focusOnToFront: true, autoHide: true, closable: true }); sender.labelElement.addListener('click', function(e) { e.preventDefault(); if (sender.labelTip) { if (sender.getPlaceholder()) { sender.labelTip.setHtml(sender.getPlaceholder() + '<br>' + '<img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"></img>'); } else { sender.labelTip.setHtml('<img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"></img>'); } sender.labelTip.show(); } }); } 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 Ну почти хорошо, только при первом нажатии подсказка всплывает вот так, а при втором уже нормально - по центру экрана. Проверил не десктопном браузере в мобильном режиме и на смартфоне. В принципе картинка-то и не нужна 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted August 19, 2020 Author Share Posted August 19, 2020 еще небольша проблемка - иконка закрытия обрезана 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.