PDA

View Full Version : Issue in selecting text of Combobox



chiragrp
5 Jan 2012, 1:49 AM
Hi,

I am using editable combobox. If I select a value from options of the combobox and then use keyboard keys shift+home/end to select and delete text of combobox, it works fine but if I just enter some text and do not pick a value from options of the combobox then it does not work.

Can someone tell me why is it behaving this way?

Thanks

skirtle
5 Jan 2012, 3:56 AM
The drop-down list intercepts Home and End key presses as a way of jumping to the top or bottom of the list. Does that explain what you're seeing?

chiragrp
5 Jan 2012, 11:17 PM
Hi Skirtle,

I have different thing to say. As you said, the Home and End key presses are intercepted by drop-down list as long as the list is open but the issue arises when some random text is entered via keyboard and not selected from the list. The issue can be found on Sencha documentation web pate at http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox

(http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox)Here is a use case:
* Visit page at http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox
* Under the "Example Usage" section click on "Live Preview" button.
* In the combo box enter text "California". At this moment the drop-down list is not visible.
* Now press key combination "Shift+Home". It should have selected text in the combo but it does not select.

Thanks

30 Jul 2013, 4:24 AM
This is indeed incorrect behaviour. "Home" should navigate the list, "SHIFT+Home" should select the text in front of the cursor. Mapping the "Page up" and "Page down"-key to browsing pages makes even more sense.

rgralhoz
25 Nov 2014, 12:09 PM
Please take a look at this POC: https://fiddle.sencha.com/#fiddle/e06

It worked with minor issues on Chrome and FF, and a few more on IE8. Since this code changes Extís default behavior, I strongly recommend a lot of testing and fine tuning before releasing it. If you have the time to fix all of the issues, please share the code back here!

Related articles:

Caret position in textarea, in characters from the start (http://stackoverflow.com/questions/263743/caret-position-in-textarea-in-characters-from-the-start)
Cursor Position in TextField
(http://www.sencha.com/forum/showthread.php?95486-Cursor-Position-in-TextField)[solved] How do you change the cursor in ExtJs (http://www.sencha.com/forum/showthread.php?84700-solved-How-do-you-change-the-cursor-in-ExtJs)
(http://www.sencha.com/forum/showthread.php?95486-Cursor-Position-in-TextField)Moving TextBox Cursor Position to Start on Blur, End on Focus (http://www.sencha.com/forum/showthread.php?76085-Moving-TextBox-Cursor-Position-to-Start-on-Blur-End-on-Focus)
(http://www.sencha.com/forum/showthread.php?95486-Cursor-Position-in-TextField)Ext.js ComboBoxes (http://skirtlesden.com/articles/extjs-comboboxes-part-1)
(http://www.sencha.com/forum/showthread.php?95486-Cursor-Position-in-TextField)