-
15 Oct 2012 6:04 AM #1
Unanswered: Keep focus on searchfield whil tab clear icon
Unanswered: Keep focus on searchfield whil tab clear icon
I have a search field and I want do write text and finish it with the iPhone keybard button DONE or ENTER. The ENTER button works with the action event but the DONE button can just be used with the blure event.
Now I just use the bluer event for sending the search request but there are a problem:
If I write something in my searchfield and want to clean it with the (X) button, so it lost the focus and the blur event starts over.
What I want is, that I can send a search request by touching the ENTER and DONE button in iphone keyboard.
How can I do that?
-
17 Oct 2012 5:09 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
Browser behavior will blur the field if you tap off the actual field which you are technically doing with the clear icon.
The issue is that blur fires before the tap on the clear iconMitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
10 Dec 2012 9:21 AM #3
this is a bad work around but this is worked for me
this is a bad work around but this is worked for me
I have some workaround for this issue but this is not a "good" workaround.
I'm using Sencha touch 2.1.
The key is inside Sencha touch file "Default.js" in function "doBlurInput".
this is the original implementation:
and this is my implementationCode:doBlurInput: function(e) { var target = e.target, focusedElement = this.focusedElement; if (focusedElement && !this.isInputRegex.test(target.tagName)) { delete this.focusedElement; focusedElement.blur(); } },
Code:doBlurInput: function(e) { var target = e.target, focusedElement = this.focusedElement; if (focusedElement && !this.isInputRegex.test(target.tagName) && (target.className.toString().indexOf('x-clear-icon') < 0)) { delete this.focusedElement; focusedElement.blur(); } },
So basically they don't calling the blur event if this is an input element but they don't checking if this is the inputs' clear icon element and prevent the blur action again.
the good part is that this workaround working.
The Bad part is that i didn't succeed to overWrite Sencha Touch class "Ext.viewport.Default"
so for now i'm overwriting the Default.js itself and if you wish to over write your clear-icon cls this is not generic solution.
I think Sencha should handle this bug in their way


Reply With Quote