Disappearing Header

The header that is attached to a grid is getting destroyed on reload. The following code snipet is supposed to clear the old list of choices and add a new one, but it is also removing the previously attached header.

			var gridSrcURL = _getGridSrcURL();
			IOBJ$.chooserGrid.clearAll(false); // false to keep header
			IOBJ$.chooserGrid.loadXML(gridSrcURL);

Here is the load method which attached the header, but never gets called again even though the new XML shows up fine (and clears the header) :

IOBJ$.chooserGrid.loadXML(gridSrcURL, function() {
var grid = IOBJ$.chooserGrid;

if (!IOBJ$.isTree && IOBJ$.useGridSort) { 
	grid.sortRows(0,"str","asc"); 
};
grid.detachHeader(0); // hides loading status message
if(!IOBJ$.isTree) {
	grid.attachHeader("#text_filter");
}
else {
	grid.attachHeader("#text_search");
}
autoSelectChooserListItem(itemKey);
				
if (grid.hdrLabels.length > 0 && grid.getRowsNum() == 0) {
	grid.addRow("no_rows_msg","Nothing found to display.");
}
else {
	grid.deleteRow("no_rows_msg");
	grid.setSizes();
}

}

grid.detachHeader(0); // hides loading status message

method in your code is detaching the first header of your grid. It’s purpose is not very clear.

After much experimenting I found the issue. The detach header really had no impact, but the inline function was only getting called on load of the page, not on reload. Once I converted it to a normal function call, and called it after reload, things started working.

The setSizes() method turned out to be the critical part. The search box was present after load, but it was buried under the newly loaded grid.