Jump to content

Trigger ClearButton


hph

Recommended Posts

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'])
            })
        }
    })
}

 

 

Link to comment
Share on other sites

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', []);
        })
    }
}
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...