After several failed attempts using ExtJS I have now decided to use javascript.The requirement is to assist a combo box in select tag.If the list contains aa,aaa,aab,abc,bac,cba then if I type 'ab' continuously then it will select 'abc'.Whereas if I type 'a' time gap and then 'b' it will select 'bac' instead of 'abc'. Can anyone tell me whether its possible in js to get what I want?If not js is it possible in Jquery.Please ignore the previous duplicates.
1 Answer
It's possible. You're going to want to track when you your keypress events fire. Capture the time the "a" was entered, and then the time the second key was entered. If it's above a threshold, you want the second letter to be first, and the first letter to come second. If it's below your threshold, you want the first letter first, and the second letter second.
-
Yes exactly.How is it possible.Can you elaborate– HarishCommented Aug 4, 2009 at 10:17
-
Do you have onkeyup for Select tag?– HarishCommented Aug 4, 2009 at 10:43
-
You will need to bind this to a textbox, and use the value of the textbox to filter the select options.– SampsonCommented Aug 4, 2009 at 11:05
-
bind to a textbox? how is that possible?– HarishCommented Aug 4, 2009 at 11:14
-
$("textbox.myTextbox").bind("keyup", function(event){ /* code here / }); Within your "/ code here */" portion is where you will filter the results, using the select > option's as your datasource.– SampsonCommented Aug 4, 2009 at 11:16