hph Posted September 5, 2018 Share Posted September 5, 2018 Hi How can I trigger a event in TUniEdit if the ClearButton is clicked? Thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 5, 2018 Share Posted September 5, 2018 Hi, Can you please explain in more detail what you wanted ? If I understand you correctly, there are several ways, one of them for example: http://forums.unigui.com/index.php?/topic/7269-how-to-capture-clear-button-event/&do=findComment&comment=37082 Quote Link to comment Share on other sites More sharing options...
hph Posted September 5, 2018 Author Share Posted September 5, 2018 Hi DD If the user click the ClearButton in TUniEdit I need to execute some code. I think the right way is to fireing the AjaxEvent? I try your example as follow, but this is not working: function afterrender(sender, eOpts) { sender.plugins.forEach(function(p) { if (p.alias[0] == "plugin.clearbutton") { // default click handler: // handleMouseClickOnClearButton: function(event, htmlElement, object) { // if (!this.isLeftButton(event)) { // return; // } // this.textField.setValue(''); // this.textField.focus(); // } // remove default click handler if is needed p.clearButtonEl.un('click', p.handleMouseClickOnClearButton, p); // add your click handler p.clearButtonEl.on('click', function(event, htmlElement, object) { ajaxRequest(this, 'clickclearButton', ['state=1']) }) } }) } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 5, 2018 Share Posted September 5, 2018 OK, try this: function afterrender(sender, eOpts) { var me=sender; if (me.triggers.hasOwnProperty('clear')) { me.triggers.clear.el.on('click', function(){ ajaxRequest(me, 'clickclearButton', []); }) } } Quote Link to comment Share on other sites More sharing options...
hph Posted September 5, 2018 Author Share Posted September 5, 2018 Hello DD It works perfectly. As allways a great work from you - many thanks! Best regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 5, 2018 Share Posted September 5, 2018 Thank you! Best regards, 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.