dhtmlxCombo - Left Position in Chrome

Hello,
It’s my first post here and I’m trying to get answer for a little problem with dhtmlxCombo rendered with Google Chrome.

In this site: dev.pordata.pt/azap_runtime/?n=4

Adding two data sets on the same tab, we can reproduce this situation (added in screenshot).

This effect isn’t reproduced in Firefox/Safari/IE.

With the GChrome Debugger and I can observe that the object position will calculated using the “original object position” relative to the body, when I open the combo, it don’t use the fact that I’m in a inner DIV with overflow/horizontal scrollbar. When I change the “position with the scroll” of the combo, the result list will stay always on the “same pixels” left of the original.

How can I fix this? I’m currently putting the dhx_combo_box inside a container div (which is on the inner HTML of the overflowed DIV)

Thanks,
And sorry for some typo mistakes :slight_smile:

Daniel Bento


Hello,

combos doesn’t open at all in your application.

Can you provide the working demo that contains only data necessary for testing ?

Also make sure that your css styles doesn’t affect combo.

Thanks for the reply.

It’s difficult to give you a pratical demo because this stuff is all dynamic and it is using a complex sctruture… The idea is to has a few searchs in the same tab (“Add Data” or “Adicionar Dados” (in Portuguese))…

The problem of not “creating” the combo, was the fact that I was forgetting to replace special chars in options XML…

I’m using the default CSS for the dhtmlx combo with some color modifications. For this specific combos (for variables, we had another in the time line), I overwriting two css properties in the elements inside dhx_combo_list. But… without this “overwrite” the problem mantains.

Thanks for the reply one more time!

Daniel Bento

I can give you this direct link:

dev.pordata.pt/azap_runtime/?n=4 … 11RyNCQ%3d

It builds all necessary data! :slight_smile:

Thanks again

Try to use the attached js file instead of the original one.
dhtmlxcommon.zip (6.64 KB)

Hello, I have tested the JS in the attachment, but it doesn’t work. After do some debugs and breakpoins, I saw that the funcion changed (getOffset) is never called…

I break the script (dhtmlxcombo.js) at “dhtmlXCombo.prototype._positList = function()” and step into the functions…

I verify that we have this function be called:
dhtmlXCombo.prototype.getPosition = function(oNode,pNode){
if (_isChrome){
if(!pNode)
var pNode = document.body

		var oCurrentNode=oNode;
		var iLeft=0;
		var iTop=0;
		while ((oCurrentNode)&&(oCurrentNode!=pNode)){
		iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft;
		iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop;
		oCurrentNode=oCurrentNode.offsetParent;
		}
		if (pNode == document.body ){
		if (_isIE && _isIE<8){
		
		if (document.documentElement.scrollTop)
		iTop+=document.documentElement.scrollTop;
		if (document.documentElement.scrollLeft)
		iLeft+=document.documentElement.scrollLeft;
		}
		else
		if (!_isFF){
		iLeft+=document.body.offsetLeft;
		iTop+=document.body.offsetTop;
		}
		}
		return new Array(iLeft,iTop);
	}
	var pos = getOffset(oNode);
    return [pos.left, pos.top];
    
}

For the specific case of Chrome, I simply replace if (_isChrome) to if (!_isChrome) because it’s nonsense to verify Firefox and IE inside a “_isChrome = true”. In this way, the instruction pos = getOffset(oNode) is called by Chrome and It Works well on this particular bug, I don’t know the impact.

At the same time I thought this: If we had if (_isChrome), all other browsers will use the last instruction var pos = getOffset(oNode) and It will only go inside the if on Chrome situation. But in Chrome is buggy. My Question is, is this if(_isChrome) particulary necessary for anything?

In fact can be this the problem resolution? I’m asking because this was a little hack to experiment this particular situation and I need a good working version of the script :slight_smile:

I hope that this reply can help on something :wink:

Thanks
Daniel Bento

Hello,

My Question is, is this if(_isChrome) particulary necessary for anything?

this check was necessary for the old Chrome version and should be used in the new one.

And every { } are in the right place? It’s strange to enter in a _isChrome validation and inside it have _isFF and _isIE too… (_isChrome,_isFF,_isIE) doesn’t have a unique true value?

My version of Chrome is the last one… not using that if () clause, it works fine. Maybe some kind of typo mistake :slight_smile:

Thanks

Sorry, there was a typo in my previous answer. It would be more correct “and should not be used in the new one”. So, you may just delete all block if(_isChrome):

dhtmlXCombo.prototype.getPosition = function(oNode,pNode){
var pos = getOffset(oNode);
return [pos.left, pos.top];
}