PDA

View Full Version : [OPEN-1460] Combo doesn't expand when user mouse pastes



metalsiren
13 Dec 2010, 1:48 PM
I have a comboBox working as an autocompleter. When my users paste into the box with the mouse (right click, select 'paste') the combo does not trigger a query/expand. CTRL+V pasting works, as it fires the key event. This behavior makes the autocompleter seem inconsistent and is frustrating for my users.

What can I do to fix this?

jsakalos
14 Dec 2010, 1:49 AM
There is onpaste event (at least in Firefox and Safari) that could be listened to at the level of the underlying textfield. You could listen to it and trigger the query from the listener.

Anyway, I would classify this as a bug (or a feature request). Do you want me to move this thread to bugs? Or to feature requests?

Condor
14 Dec 2010, 1:55 AM
Try:

Ext.override(Ext.form.ComboBox, {
initEvents: Ext.form.ComboBox.prototype.initEvents.createSequence(function () {
this.mon(this.el, {
cut: this.onCutPaste,
paste: this.onCutPaste,
scope: this
});
}),
onCutPaste: function () {
if (this.editable !== false && this.readOnly !== true) {
delete this.lastKey;
this.dqTask.delay(this.queryDelay);
}
}
});
Doesn't work on Opera though.

Warning: Completely untested code!

metalsiren
14 Dec 2010, 10:18 AM
Saki, I'd say this is more of a bug as it doesn't work as expected. Move it to whichever section you think is more appropriate, though.

Condor, I'll try your override and post about how it goes.

Thanks to both of you.

jsakalos
14 Dec 2010, 10:54 AM
OK, moving to bugs.

metalsiren
14 Dec 2010, 11:20 AM
Condor, that override works for me on IE8, FF3.6, and Chrome. You're right about Opera not working, but we don't officially support Opera here so it's okay with me.

We'll stick with the override until the bug. Thanks again, you guys!