LeaVerou / awesomplete

Ultra lightweight, usable, beautiful autocomplete with zero dependencies.
http://leaverou.github.io/awesomplete/
MIT License
6.97k stars 611 forks source link

Multiple values: Am I to stupid? #17060

Open Mike-DE-RE opened 7 years ago

Mike-DE-RE commented 7 years ago

Hi.

I've tested a lot and learned a lot!

Here is my html-sample:

test.txt

Here you see what happens, when I select "E10/13, 6V".

result

As per "Multiple values" sampe I expected a different result:

sample

What do I do wrong?

Thanks

Michael

Mike-DE-RE commented 7 years ago

That is very polite of you, not to answer my question. ;-)

Maybe I should have posted this when I started my question. Here is what happens, when I type the first part in Lea's sample:

temp1

... and here is the same, when I do it in my sample:

temp

It looks to me as if Lea's sample has and "and" condition and mine has an "or" condition.

I have already seen another thread asking about the disappearance of the yellow marking, so I do not post about it here.

Have a lot of fun...

Mike-DE-RE commented 7 years ago

You learn something new every day. So here is today's lesson:

test3

When entering "6V, E10/13" instead of "E10/13, 6V" multiple values work as expected. I am quite sure that it is not intended, because the user will not always know the order of appearance of his search terms. I hope that this showes where the problem comes from.

Can it have to to with the spaces in my strings?

No, it doesn't:

test4

Can it have to do with the commas in my string?

No, it doesn't:

test6

As always, have a lot of fun...

LeaVerou commented 7 years ago

Hi there,

Looks like you may have discovered a bug. Could you make a reduced test case? I.e. the fewest and simplest options that still reproduce the problem.

Mike-DE-RE commented 7 years ago

Yes, Sir. ;-)

test.txt

That small sample has seven different entries:

AA BB ZZ AA CC ZZ AA DD ZZ AA EE ZZ BB AA YY BB BB YY BB CC YY

See what happens:

1

2

3

4

5

Hope that helps!

Best wishes

Michael

LeaVerou commented 7 years ago

Yes, Sir. ;-)

I’m a woman.

Please don't attach txt files. That means that whoever wants to look into this issue needs to download your file, rename it, and then open it in a browser. Our time is very limited. Better use a service like http://codepen.io and have an online demo. Then all it takes to look at your testcase is clicking a link.

@vlazar any chance you could look into this?

Mike-DE-RE commented 7 years ago

I’m a woman.

I know that very well. So you prefer

Yes, ma'am?

I must admit that I have no experience with "online demos".

I tried

http://codepen.io (to complex for me) https://jsfiddle.net (can't get that to run)

Finally I was able to place it here

https://jsbin.com/sujusoredi/edit?output

Code online - result is completely different, took only few hours.

Regards

Michael

LeaVerou commented 7 years ago

Thanks, this helps! I'll wait for @vlazar since I don't have time to work on this right now, but it seems you've found one (maybe even 2) actual bugs.

Mike-DE-RE commented 7 years ago

You're welcome!

When I am able to profit from your work, why shouldn't you be able to profit from me.

Regards

Michael

Mike-DE-RE commented 7 years ago

Ha!

Try this:

https://codepen.io/anon/pen/qmRLGp

Mike-DE-RE commented 7 years ago

Code online - result is completely different, ...

Can that have to do with

Works in codepen, but not with local js file. ... https://github.com/LeaVerou/awesomplete/issues/17064

I can hardly belief it myself. I remember to have tested "Multiple values" sample from Lea's project homepage and from the local index.html in the ZIP-File and did not see any difference.

Let me continue this a little longer and l'll show you that the whole internet is a fake. :-)

Mike-DE-RE commented 7 years ago

Adding patch https://github.com/LeaVerou/awesomplete/commit/7b17750802ee3a73d9c19f5dca1da71648f52a36 suggested by @davidkna (thank you!) to fix "Hightlight" with "Multiple values" - see https://github.com/LeaVerou/awesomplete/pull/17065 - showes following result:

0502-1

0502-2

0502-3

0502-4

@LeaVerou is this meant to be like this? Maybe it's no bug, but a feature. ;-)

I would have expected that using "Multiple values" means limiting the number of results ("ZZ" and "AA"). Further would I have expected that both search terms "ZZ" and "AA" should be highlighted at then end.

This is not necessarily as expected. Can you please give a short explanation of your intention?

Have a nice day!

Michael

schnuti commented 7 years ago

@Mike-DE-RE I think you missunderstand the Multiple Values. It's not about Multiple Look-up-values but multiple selected values separated by a comma.

Is there a setting to prevent from adding values not in the selection list, to the input field? And a value should only be allowed to be included once. Both is valid in almost all cases I know of - with exceptions!

i.e. in the examples above this should not be possible. ZZ,AA,BB or AA BB ZZ,AA BB ZZ

The result should be i.e. AA BB ZZ,AA CC ZZ,BB BB YY

schnuti commented 7 years ago

@Mike-DE-RE You probably don't need autocomplete but some kind of search. I know how to do that with a database table but it is a bit more complex as you normally need AND, OR, NOT. Normally not used in selection lists. Or you use multiple levels of autocomplete lists. (1. Select article group 2. Select article in selected group. 3 select colour for selected article)

Mike-DE-RE commented 7 years ago

@schnuti

You probably don't need autocomplete but some kind of search.

Might be right, that's the reason why I wrote:

I would have expected that using "Multiple values" means limiting the number of results ("ZZ" and "AA"). Further would I have expected that both search terms "ZZ" and "AA" should be highlighted > at then [the] end.

This is not necessarily as expected. Can you please give a short explanation of your intention?

I know how to do that with a database table but it is a bit more complex as you normally need AND, OR, NOT.

That's the reason why I am looking for a very easy way to generate that kind of "search".

I still cannot understand the idea of "multiple values". Can you make this a little bit more transparent?

Thanks

Michael

schnuti commented 7 years ago

@Mike-DE-RE A common use of multiple values are for tags (categories). I suppose you've seen it on the web. An item (e.g. article) is included in more than one category (tag). Holydays, Italy, Rome, Mediterranean ... When you edit the article you can choose more then one category from a drop down list, In this fantasy maybe Living, Holydays, At home, My country, Italy, Spain, My Town, Rome, Madrid, Mediterranean, North sea, Sunny days, Raining days... Got it?

Sorry, I can't see any easy solution for you. You would have to program it in one or more programming languages.