Issues of Autocomplete

Hello Experts,
I have some issues related to Autocomplete of combo, I will appreciate if you support:

  1. Filtering on server is annoying because I have so many similar choices and when I start to type immediately it will choose one of them.
    1.1 is there any way to start suggestion after 3 letters?
    1.2 is there any way to put suggestion after 500 ms when that’s stable?
    1.3 when mouse is overing the suggestion it will select one of them immediately. This is not good at all.
    2.when you choose ‘start’ filtering mode when you start typing it will select a matched one, but In between filtering mode it will not match with any of them automatically and you need to select your choice manually from filtered list item. It will be good if after ‘enter’ it will select one of them.

Thanks a lot in advance for your support.
Br,
Beniy

Hello beniy

You need take a look at _filterOpts function.

See attachment.
If the only one option is left Combo will autocomplete.

And what version do you use?
dhtmlxCombo_v411_std_autocomplete.zip (108 KB)

Hello Avalon,
I’m using the latest one, Yeah I saw them.

But I did not get my answer about :

1.2 is there any way to put suggestion after 500 ms when that’s stable?

2.when you choose ‘start’ filtering mode when you start typing it will autocomplete a most matched one, but In “between filtering mode” it will not match with any of them automatically and you need to select your choice manually from filtered list item. It will be good if after ‘enter’ it will select one of them exactly like as start mode.

Thanks

Hi,

Yes. In first attachment I put 500 instead of 200 in setTimeout (_filterOpts function). I think it’s what you want.

I added in the same function
else { if ( (that._getListVisibleCount() == 1) && (that.conf.f_mode == "between") ) { that.base.firstChild.value = text; that._selectRange(k.length, text.length);} }

OR

You can put in your server script (php) something like
if (strlen($mask)>3 ) - return result.
sleep(5) - wait 5 seconds and return result.
server samples, for example 06_02

At first Thank you so much.
But the file that you have sent is not working, but I understood the waiting function and after 3 letters…
Just one thing where did you change this function? I meant which file is that?
else {
if ( (that._getListVisibleCount() == 1) && (that.conf.f_mode == “between”) ) {
that.base.firstChild.value = text;
that._selectRange(k.length, text.length);}
}

And one more thing, when I was talking about Between mode I’m talking about example 04_opts_loading/04_from_xml_server.html
XML from server…

I want to search in between mode and after enter it select the most similar one.
.when you choose ‘start’ filtering mode when you start typing it will autocomplete a most matched one, but In “between filtering mode” it will not match with any of them automatically and you need to select your choice manually from filtered list item. It will be good if after ‘enter’ it will select one of them exactly like as start mode.

And one more thing, when I was talking about Between mode I'm talking about example 04_opts_loading/04_from_xml_server.html XML from server...
Thanks. That’s another matter.

In this example time is hardcoded to 500ms in JS! And take a look at 3 letters)
dhtmlxCombo_v412_std_autocomplete.zip (85.3 KB)

That’s ok. Thanks a lo and your support is highly appreciated.
what about between mode?
in xml start mode if you for example start to type ‘chi’ it will select and auto complete ‘china’ and after ‘chi’ you can enter and it would be completed. But in betweeen mode that is not like that you can try to type ‘ina’

And also please let me know where did you add I mean were should I add:

else {
if ( (that._getListVisibleCount() == 1) && (that.conf.f_mode == “between”) ) {
that.base.firstChild.value = text;
that._selectRange(k.length, text.length);}
}

I’ve add it already.

You need to experiment with _filterOpts function.

You can add && k.length > 3 in if () for start mode (lines 183; 224)
Also it is desirable to add that._checkForMatch(); after that._hideList(true); in if() in this function. See 1st attachment

Because > 3, not >= 3. You need ‘hina’)

Or instead of all that you can put

if (k.length > 3)
[/code]after comment[code]
// check cache

and

if (k.length > 3){... after comment (don’t forget about closing ‘}’ ) // client In case with script (not xml) browser won’t send a request to the server. See 2nd attachment.
cmb.zip (12.8 KB)
cmbRequest.zip (12.7 KB)

Dear Avalon,
Thank you so much for your nice support, That’s working fine except for “multi columns” XML. which is not matter for me but maybe important for you :slight_smile:

But one more question if you do not mind ,
I want to get one element of XML from user and do some process on that in client side, like as following code.
Is it possible with dhtmlxcombo to do this???

for example in following code I want to get variable “V” from user (here as an example I gave constant value) and return back some other elements of xml.
Is it possible with combo?

Thanks in advance.

xmlDoc=loadXMLDoc(“PARAMETER.xml”);

x=xmlDoc.getElementsByTagName(‘Param’);
y=xmlDoc.getElementsByTagName(‘Category’);
V=“Flexi”;
for (i=0;i<x.length;i++)
{
if (y[i].childNodes[0].nodeValue==V){
document.write(x[i].childNodes[0].nodeValue);
document.write("
");
}
}

Hi, beniy!
Take a look at PHP Connector
docs.dhtmlx.com/connector__php__index.html

Thanks Avalon,
I know how to do it in PHP side, I wanted to know that When I’m using combo, Can I load XML and do that action on client side? Please take a look at my previous post, That is in client side and I want to do same thing with combo…

beniy,

Describe more in detail what is it you mean? Describe expected behaviour.

To get xml from response you can use
dhx4.ajax.get(url, function®{…})
docs.dhtmlx.com/api__refs__dhtmlxajax.html