PDA

View Full Version : TextField/TextArea becomes uneditable if it is drag source



jeffrey
18 Dec 2009, 2:59 PM
See the sample: http://www.extjs.com/deploy/dev/examples/dd/field-to-grid-dd.html.
I can not put cursor in the text fields and date field. Anyone knows how to solve the problem?

Thanks.

tot2ivn
20 Dec 2009, 7:36 PM
Hi Jeff,

you can add this simple event handler to class Ext.ux.PanelFieldDragZone:


onMouseUp: function(e) {
this.dragData.field.focus();
},

It could be onMouseDown depending on how you want the field to be focused.

Cheers,

Totti

jeffrey
21 Dec 2009, 10:53 AM
It works!

Thanks tot2ivn.

Stefan B
9 Feb 2010, 6:53 AM
@ tot2ivn

Perfect, adding that kind of mouseup handler to a drag zone worked for me, too (http://www.extjs.com/forum/showthread.php?t=91649).

Note that you can't use onMouseDown instead, because focussing the field would interfere with the original mousedown event data. They are stored in the Ext.EventObject singleton and required by the dragging implementation to work properly.
If you focus the field onMouseUp however, all drag and drop processing is over already, no data getting spoiled.

Thanks,
Stefan

tot2ivn
9 Feb 2010, 6:58 AM
@ tot2ivn

Perfect, adding that kind of mouseup handler to a drag zone worked for me, too (http://www.extjs.com/forum/showthread.php?t=91649).

Note that you can't use onMouseDown instead, because focussing the field would interfere with the original mousedown event data. They are stored in the Ext.EventObject singleton and required by the dragging implementation to work properly.
If you focus the field onMouseUp however, all drag and drop processing is over already, no data getting spoiled.

Thanks,
Stefan

Thanks for your note Steve :D

Totti