| Page 1 of 1 | [ 9 posts ] |
|
**** EDIT - see last post
I've implemented the YUI autocomlete before. The JSON array was built by looping through a resultset or users. And that works fine. Now i'm trying to extend that. Now I only want certain users from the original data source. So I added a 2nd loop inside the first to compare the users in the original data source to my subset of users. It works, but it's a fair bit slower. I can accept the performance hit, but there's a weird little glitch. If you type each letter slowly you will get the correct result, but then it refreshes and shows previsous results from previous keystrokes. For example, if I type "c" ... "o"... "n" waiting 1 sec between each keystroke, the correct result shows for "con". Then it refreshes and shows the results for "co" then refreshes again and shows the results for "c". I wish I could avoid the double loop. But, unfortunalety it's 2 separate data sources. The original data source is from a database and the other comes from Active Directory. Last edited by reggi on Fri Apr 27, 2012 11:24 am, edited 3 times in total. |
|
I think I can get all the data I need from active directory so I don't even have to use the other database. I'll put this into 1 resultset and i'll be back to creating the JSON with 1 loop instead of a double loop, which works fine with the YUI autocomplete.
Not sure why the autocomplete can't handle a double loop, but it's not something you should be doing anyway i guess. |
|
Ok, I've only got the 1 loop now. Everything works, EXCEPT, the first keystroke shows the list alphabetically. Then on the 2nd keystroke it's in order. To troubleshoot. I removed my service call and loop and hard coded the JSON array. And it still shows the JSON array as it is originally instead of showing the correct list based on keystroke. What am I missing here? Is there some initial call?
|
|
To clarify, on the 1st keystoke it's returning the max result of the JSON array from the beginning of the array sequentially. On subsequent keystrokes I get the correct results. Example. I type "b" I get max results in original sort order. Next I type "i", then I get the correct results starting with "bi". If I backspace to just "b" I get the correct results. Even if I clear it and type "b" again I get the correct resuls (items starting with "b"). Selecting items from the list never works. It just clears the textbox. I'm guessing that's related to my problem. I've tried messing with the delay, and minimum characters, doesn't work.
To summarize. I have a working version of autocomplete that queries the database, creates a resultset. Then loop out the resultset creating the JSON on-the-fly. So, instead of querying the database, i'm using JAVA to query active directory, but ultimately i'm creating a resultset the same way, but it doesn't work. I've looked at the resultset with both versions and it looks correct. The JSON must be in the right format or it would never work. I don't get what the difference is here. Ultimately is a JSON array. Both created on-the-fly with the AJAX call. |
|
Ok, back to hardcoded JSON (validated JSON)
https://gist.github.com/2501627 And here's my javascript https://gist.github.com/2501617 I still have the bug described above. 1st query entered brings back everything. Do the same query again, works. |
|
Ok forget my previous posts. I've set this up on a regular webserver with static JSON. Why doesn't this work? What do I have wrong?
https://gist.github.com/2512024 https://gist.github.com/2501617 https://gist.github.com/2501627 |
|
I guess it's a bug
|
|
Well, couldn't figure it out, so I upgraded to YUI 3 and it works fine now.
|
| Page 1 of 1 | [ 9 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group