WebViewer Version: 8.5.0
I am trying to move around some header options. For example, I want to move the searchButton (currently on the right side of the header) to after the panToolButton. I am attempting to use the header UI “.insertAfter” method, but also tried the “.insertBefore”. No matter what I do, all I can do is wind up with either a duplicate panToolButton on the left, or a duplicate searchButton on the right.
THIS yields a second Search button on the right:
// This yields a second search tool button, but it is on the right, not the left after the pan tool)
instance.UI.setHeaderItems(function (header) {
header.getHeader('default').get('panToolButton').insertAfter(header.getHeader('default').get('searchButton'));
});
// This does the same thing (two search tool buttons, both on the right)
instance.UI.setHeaderItems(function (header) {
let panToolButton= header.getHeader('default').get('panToolButton');
header.getHeader('default').get('searchButton').insertAfter(panToolButton);
});
THIS yields a second Pan Tool button on the left:
//This yields a second pan tool button, both on the left (instead of a second search tool on the left)
instance.UI.setHeaderItems(function (header) {
header.getHeader('default').get('searchButton').insertAfter(header.getHeader('default').get('panToolButton'));
});
// This does the same thing (two pan tool buttons, both on the left)
instance.UI.setHeaderItems(function (header) {
let searchButton = header.getHeader('default').get('searchButton');
header.getHeader('default').get('panToolButton').insertAfter(searchButton);
});
And this does nothing at all:
instance.UI.setHeaderItems(function (header) {
let searchButton = header.getHeader('default').get('searchButton');
let panToolsButton = header.getHeader('default').get('panToolsButton');
//header.getHeader('default').delete('searchButton');
panToolsButton.insertAfter(searchButton);
});
What am I doing wrong?