EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Pierre on January 02, 2017, 01:47:48 AM



Title: [SOLVED] DoubleClick event on TextBox
Post by: Pierre on January 02, 2017, 01:47:48 AM
Hello
how to know when user doubleclicked on textbox?
As I can see there is no such event.
Thank you for help.


Title: Re: DoubleClick event on TextBox
Post by: stworthy on January 02, 2017, 11:49:14 PM
You can extend the $.fn.textbox.defaults.inputEvents to attach a dblclick event.
Code:
$.extend($.fn.textbox.defaults.inputEvents, {
dblclick: function(e){
//...
}
})


Title: Re: DoubleClick event on TextBox
Post by: Pierre on January 03, 2017, 12:36:20 AM
Hello
thank you. I appreciate your help.


Title: Re: DoubleClick event on TextBox
Post by: Pierre on January 03, 2017, 05:45:31 AM
Hello
thank you. I appreciate your help.

Hello
I still don't know how to implement this on simple textbox.. :(
If I have textbox with id="my", how would be the sample code to check does user doubleclicked on my textbox?
Thank you.


Title: Re: DoubleClick event on TextBox
Post by: Pierre on January 03, 2017, 06:03:43 AM
Hello
if I use this:
Code:
$.extend($.fn.numberbox.defaults.inputEvents, {
dblclick: function(e){
alert($(this).attr('id')); 
}
})
then I see something like: _easyui_textbox_input37
Question is - how to get input ID (I have declared id and name).
Thank you.


Title: Re: DoubleClick event on TextBox
Post by: stworthy on January 03, 2017, 08:22:10 AM
Please try this code.
Code:
$.extend($.fn.numberbox.defaults.inputEvents, {
dblclick: function(e){
var t = $(e.data.target);
var id = t.attr('id');
var text = t.textbox('getText');
}
})


Title: Re: DoubleClick event on TextBox
Post by: Pierre on January 03, 2017, 10:26:05 AM
Thank you, it is not what I needed but I found a solution (I need to know on what field user doubleclicked, not what value have the field).
Here is how I use it now:
Code:
$.extend($.fn.numberbox.defaults.inputEvents, {
dblclick: function(e){
var t = $(e.data.target);
var id = t.attr('id');
alert(id); <- Here I see my field "id", like "first_name", "last_name" etc.
}
});

Thank you!  ;D