Hi, experts,
I am having an issue with the Combo box component.
Before I enter any text, if I click the arrow, nothing happens, no ajax request is sent to server side. What I wanted is this combox still send ajax request to server, it is up to the server side to determine if a full options are shown in the dropdown or show none.
Many thanks in advance!
Regards,
Tao
Hello,
you can try to use the following approach to load all options when combo opens:
var combo = new dhtmlXCombo(“parentId”,“combo”,200);
combo.enableFilteringMode(true);
var openEv = combo.attachEvent(“onOpen”,function(){
combo.loadXML(url,function(){combo.openSelect()});
combo.detachEvent(openEv);
})
Thanks a lot for your reply, and your code sample.
After I made the code change like your sample code, now it shows my all the options when nothing is entered. This is good. But… when I start typing something, it doesn’t go the server again.
What I wanted is that it always go to the server side.
Your help is appreciated!
Thanks,
Tao
Here is my code:
var z = new dhtmlXCombo(“comboZoneMunicipality_${var}”,"${submittedFormFieldName}", “100%”);
z.enableFilteringMode(true,“municipalityservlet”,true);
z.setOptionHeight(255);
z.setComboText(’${municipalityLocationName}’);
var openEv = z.attachEvent(“onOpen”,function(){
alert(‘aaa’);
z.loadXML(“municipalityservlet”, function() {z.openSelect()});
z.detachEvent(openEv);
});
Thanks a lot for your reply, and your code sample.
After I made the code change like your sample code, now it shows my all the options when nothing is entered. This is good. But… when I start typing something, it doesn’t go the server again.
What I wanted is that it always go to the server side.
Your help is appreciated!
Thanks,
Tao
Hello,
the z.enableFilteringMode(true,“municipalityservlet”,true); method enables autocomplete (dynamic loading).
But the 3rd parameter of the enableFilteringMode mode enables caching. So, you can use use just z.enableFilteringMode(true,“municipalityservlet”) to send a request eahc time a key is pressed.
Hi, Alex,
Thanks a lot for your quick response.
I was aware of the third parameter of enableFilteringMod, and I tried it as well. No success.
I guess you didn’t get me. The point is shown as below.
Source code in “dhtmlxcombo.js"
dhtmlXCombo.prototype._fetchOptions = function (ind, text) {
if (text == “”) {
/* this.closeAll();return this.clearAll() */
};
var url = this._xml + ((this._xml.indexOf(”?") != -1) ? “&” : “?”) + “pos=” + ind + “&mask=” + encodeURIComponent(text);
this._lasttext = text;
if (this._load) this._load = url;
else {
if (!this.callEvent(“onDynXLS”, [text, ind])) return;
this.loadXML(url)
}
};
I tried to modify the source code of “dhtmlxcombo.js” in order to to achieve what I wanted, It turns out I just need to comment out one line of code, please see above.
It works now.
Anyways thank you!
Btw, can I use this modified version of this component for an Government project(not open source)?
Thanks again!
Tao
Hello,
dhtmlxCombo GPL license can only be used in GPL(open source) projects for free.
Hi, Alex,
Thanks a lot for your confirmation. I am evaluating DOJO option now.
Btw, dhtmlxCombo is neat though.
Cheers,
Tao