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( ) {
mygrid.enableCSVHeader(true);
var savedFilterValues = getFilterValues();
mygrid.detachHeader(1);
document.create.p_csv_data.value = mygrid.serializeToCSV();
mygrid.filters = []; // without this line, the getFilterElement fails after “attachHeader”
mygrid.attachHeader(‘COLUMN_ATTACH_HEADERS’);
fixFilterHeaders();
restoreFilterValues(savedFilterValues);
mygrid.filterByAll();
document.create.p_action.value = ‘sendToCSV’;
document.create.p_option.value = ‘admin.UserSignonDisplay’;
var randomizer = ‘UserSignonWindow’ + Math.floor(Math.random() * 10000);
document.create.target = randomizer;
document.create.submit();
}
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”.
Thanks