getFilterElement broken after detachHeader/attachHeader

I am doing a detachHeader before a serialization so as not to serialize the filter headers. After that, I attachHeader the prior headers and restore their values. It’s all good, but when I access getFilterElement, I don’t get the new filter elements in the header. Apparently, the “filters” array is augmented by the attachHeader instead of being reset.
By inserting this line:
mygrid.filters = [];
before the attachHeader, it works okay.
Here is the code:
function doSubmitCSV( ) {
var savedFilterValues = getFilterValues();
document.create.p_csv_data.value = mygrid.serializeToCSV();
mygrid.filters = []; // without this line, the getFilterElement fails after “attachHeader”
document.create.p_action.value = ‘sendToCSV’;
document.create.p_option.value = ‘admin.UserSignonDisplay’;
var randomizer = ‘UserSignonWindow’ + Math.floor(Math.random() * 10000); = randomizer;

It seems to me that this is a (minor) bug in the “attachHeader” method.
I should not have to modify an internal variable like “filters”.

Unfortunately this is the expected behavior.
Filter is attached to the html element of the header. so detaching the header you will lose the original html of the filter.
so, as you’ve mentioned, you need to clear (destruct) the filters:
mygrid.filters = [];
so you are able to create new for the hew header.