|
If you scroll to the top of this article, you'll see a golden medal with words "Prize winner: August, 2007" to the left of it. It means, that this article won the CodeProject's Monthly Article Competition I would like to say "thank you a lot!" to everyone who voted for this article (both for the article itself, and in the survey).
Next, let me announce the next article/code update. It is due to October 8th (Monday; but the actual update will probably be delayed for a day or two because CP editors' load), and will include some fixes/features found and proposed by the users of this control.
Thank you very much again,
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
If you set actb_firstText=false, then put in this array...
var customarray = ['audi','bentley','buick','chevrolet','chrysler','dodge','ford','gm','honda','hyundai','isuzu','jeep','kia','lamborghini','mazda','nissan','opel','pontiac','renault','saab','toyota','vw'].sort();
...then type the letter 'a', the display order of the results is incorrect. This does not happen on the original version.
I have not compared the code itself--just the output. Any ideas?
|
|
|
|
|
I get the same printing order with the latest version of this script and the original zichun's code.
Can you post what order you've got?
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Instead of 'a', let's go with 'c'--it's easier to see what's going on.
Zichun's code: buick, chevrolet, chrysler, pontiac
Updated code: chevrolet, chrysler, buick, pontiac
Zichun's is correct. Both are using the exact same input array, with a .sort() on it.
I have actb_firstText and actb_noDefault both false. It's possible that my "Zichun" code is improved over the original. (A lot of people worked on it over the last year and I didn't compare it back to his last post.) I already sent you that version, so you can use that for reference. Either way, that's the one that is right.
|
|
|
|
|
Aaaahhh... Now I see.
The problem is that I thought that the user should first get the variants that match the 1st letter, and then all the other variants - so I changed the Zichun's procedure that constructs the suggestion list.
Should I revert it back? Or should we have a switch (variable) for this behavior?
I'll post a patch here a bit later today.
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
We should definitely have a switch. There are advantages both ways. By the way, the code looks great and congratulations on the award!
You might also look at incorporating the css like in the example I sent. Your version can easily be modified (I've been experimenting!) and the flexibility would be incredible. In fact, the code even gets a little smaller.
|
|
|
|
|
LTSpeed wrote: congratulations on the award!
Thanks a lot!
LTSpeed wrote: We should definitely have a switch.
Will be on the next update.
LTSpeed wrote: You might also look at incorporating the css like in the example I sent. Your version can easily be modified (I've been experimenting!) and the flexibility would be incredible. In fact, the code even gets a little smaller.
My current mania is focused on creating a self-contained components, but I will definitely make a CSS-enabled version a bit later.
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
done function should be replaced by this code:
done: function(ot, t)
{
if(ot.length < this.actb_startcheck) return;
var re = new RegExp(this.actb_firstText ? ("^" + t) : t, "i");
this.actb_total = 0;
this.actb_tomake = false;
var al = this.actb_keywords.length;
for(var i = 0; i < al; i++)
{
this.actb_bool[i] = false;
if(re.test(this.actb_keywords[i]))
{
this.actb_total++;
this.actb_bool[i] = true;
if(this.actb_pre == i) this.actb_tomake = true;
}
}
if(this.actb_timeOut > 0)
this.actb_toid = setTimeout(function(){ this.actb_mouse_on_list = 0; this.actb_removedisp(); }, this.actb_timeOut);
this.actb_generate();
}
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Is it possible to apply the auto-suggest javascript in a Firefox toolbar extension so that the auto-suggest list pops up above all other window content similar to how the Google toolbar works?
I have so far only gotten your javascript to work by placing an iframe into my toolbar the same size as the auto-suggest pop-up, but this always shows and causes other issues with Firefox. When I try to apply the code directly to an input box it doesn't suggest anything (or maybe it does and I just can't see the list).
Google's toolbar uses a menulist as the textbox and I have yet to reverse engineer their gtb.js to see how they populate the auto-suggest list.
I'm hoping someone has already looked at gtb.js and might be able to offer a suggestion on how I could modify Dmitry's code to populate the menulist the same way that Google does.
There also may just be some simple xul code to do this that I don't know.
Thanks for any replys!
|
|
|
|
|
Hi Dimitri,
I want to start by saying thank you for this latest version which includes the iFrame fix and other fixes.
You're a hard worker, diligent and you know what you're doing.
In the hope of improving on your already very successful code, I would like to point out a bug.
The error is: "'actb_display' is null or not an object". It occurs when we work wit the autocomplete in non-full screen mode or when the list is close to boundaries of the partent window _ in both cases it forces the control to move the list and it appears that if we catch it just right, we can get it where we have the mouse pointer on a record yet the record is not highlighted. When we click, nothing happens and the javascript error appears in the browser's status bar.
As you know, I am using IE 6 and need to use iFrame to avoid having other controls peering through the list.
I pull data from url.
The workaround for now is to either work in full screen (the prolbem appears to be scoped to the way the code is calculating where the mouse pointer is with respect to the row it's on, so when in full screen the list has lesser a chance of being moved from its default locatin, but when in a tight bind the list is displaced and the calculation appears to fail at odd moments) or use the keyboard when the mouse selection becomes buggy.
Best Regards,
Alonfoso Pilato
-- modified at 7:35 Monday 24th September, 2007
|
|
|
|
|
Hi alfonso,
sorry for late answer. I'll try to investigate this issue shortly and will post a solution here.
Best regards,
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
if you want to load the data from db, how would you do that?
i understand you have hardcode all the data in arrays but do you have any exmaple that fetch from db ?
thanks.
|
|
|
|
|
Hi,
retrieving data from the database is not JavaScript's job - it is the job of a server-side script (ASP, PHP, etc.) This site has lots on ASP+database stuff - just search in ASP/ASP.NET categories. For PHP, use google - there are lots of info on the internet.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
i did not mean you to write me the server-side script, what i mean by that is.... is that possible feteching the data from db?? if yes can you just give me idea? (i'm not asking you to write whole script for me) but give me some heads-up.
thanks.
|
|
|
|
|
|
Hi Dimirty, I found I can use in textarea with an additional space delimiter in the javascript file. This gives us flexibility to write some complex language like hindi, bengali etc. which more alphabets than the English letters. I was wondering whether it is possible have the suggestion list dynamically next to the curser where I'm typing. For textarea this method would be excellent. I was looking for such solution for a long time, but couldn't get one. After I get this script, it seems to me this the right place to raise the issue.
Thanks, hkabir
|
|
|
|
|
Hi hkabir,
Thanks for your observation; this is a really interesting task to do. This feature (moving the suggestion list with respect to the caret) was asked previously; now I see that it is much wanted feature
I'll try to address it in the next release (due to early October, probably).
Best regards,
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
|
hellow,if you can, mail to me also.
thanks
my email: taoqianbao@hotmail.com
db,exmaple
|
|
|
|
|
Great work man. Congratulations!
But, I have one suggestion: The possibility of assigning a value for each item. So, I can use it to store entity key values.
Regards,
Marco Alves.
|
|
|
|
|
Hi Marco,
Marco2250 wrote: Great work man. Congratulations!
Thanks a lot!
Marco2250 wrote: But, I have one suggestion: The possibility of assigning a value for each item. So, I can use it to store entity key values.
That is the 2nd time this suggestion arises. Looks like it is really useful Will do it on the next update (due to Sept 28th).
Best regards,
- Dmitry.
P.S. If it won't bother you, can you please vote for this article in the CodeProject's Monthly Survey:
http://www.codeproject.com/script/survey/survey.asp?survey=721
Thank you very much in advance!
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Of course it doesn't bother me.
I've voted!
Regards,
Marco Alves.
|
|
|
|
|
Thank you, Marco!
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Nice article
Thanks Dmitry ...
|
|
|
|
|
|