Toolbar - Spacer Item

Is the only way to add a spacer through code or can it be initialized in XML?

Using addSpacer method is the only method. Unfortunately, spacer can not be set in the xml.

It would be very nice to be able to add a spacer using XML. It requires some ugly code to add one right now. The way i do it is like this:

toolbar.clearAll();
toolbar.addText(“start”, 1, " ");
toolbar.addSpacer(“start”); // Spacer cannot be added in XML, so we do it here
toolbar.loadXML(“http://localhost:8080/core2/GridToolbar?cat=” + catalogId);

This only works if you want everything in the toolbar right aligned.

You need to use this method as a function in the second parameter of load XML:

toolbar.loadXML("dhxtoolbar.xml", function() { toolbar.addSpacer("open"); });

Is it still the case that this can not be initialized via xml? It would be very handy if this was possible, especially in scenarios where the menu is built dynamically.

cfei, you can post this request here:
viewforum.php?f=10