Alignment with loadXML

I want to align a toolbar item to the right. First I tried:

toolBar.loadXML("file.xml");
toolBar.addSpacer(align_right_after_this_id);

addSpacer only seems to work if I build the toolbar with javascript. But if I load from XML I can’t get it to work.

I even tried:

toolBar.loadXML("file.xml");
toolBar.addSpacer(align_right_after_this_id);
toolBar.loadXML("file.xml2");

You need the next:

toolBar.loadXML("file.xml", function(){ toolBar.addSpacer(align_right_after_this_id); });

Thanks, that worked.

You are welcome!

There seems to be a bug when using addSpacer() as an onload function with loadXML(). It doesn’t always move to the right (see screen shot). Not only that, the button caption ends up inside my input box. If you move over it, then it jumps over to the right (see 2nd screen shot). It doesn’t happen consistently.




Update: I can reproduce this consistently now. It happens when you resize the browser window. I can reproduce this on multiple computers. Problem occurs in IE8 and IE10

Could you please provide us a demo?
docs.dhtmlx.com/doku.php?id=othe … leted_demo
Locally everything works in all IE versions.

Compatibility mode was on and switching to IE7 mode, arg.

So, have you solved the issue by switching to right mode?

Yes it’s solved. The solution is to use the X-UA-Compatible meta tag to ensure the document mode is IE8 standards. Turning off compatibility mode works too, but I can’t rely on this being off since the user has the ability to changes this.