dhtmlxcombo behavior changes onchange and onkeypressed event

Hi,

I am using dhtmlxCombo and using it’s onchange and onkeypressed event

both of these events are equally important.when onkeypressed event is called an ajax call is made for dynamically getting the filtered list.

function initParticipantCombo()
{
	participantCombo=new dhtmlXComboFromSelect("participantCombo");
	participantCombo.enableFilteringMode(false);
	participantCombo.setOptionHeight(200);
	participantCombo.attachEvent("onChange", participantOnRowSelect);
	participantCombo.attachEvent("onKeyPressed", participantComboOnKeyPress);
}


function participantComboOnKeyPress(key)
{
          participantCombo.loadXML("ParticipantConnector.do?csId=" +csId+"&filterValue=" +      participantCombo.getComboText());
	if(key == 13)
	{
		if(participantCombo.getSelectedText() != "")
		{
			participantCombo.setComboText(participantCombo.getSelectedText());
		}
	}
}

but whenever a value is selected using ENTER key and after that if I click anywhere outside, it again calls the participantOnRowSelect() method.

Any help would be greatly appreciated.
Thank you

Hi,

why aren’t you using a ready solution for filtering ?

dhtmlxCombo/samples/04_filtering/02_combo_filter.html

it again calls the participantOnRowSelect() method.

onChange is called when the combo input loses focus. You may set additional check in order to not call loadXML for onChange after Enter key