Вот решение, которое я придумал при изучении предмета. Чтобы получить все неперечислимые несобственные свойства объекта obj
do getProperties(obj, "nonown", "nonenum");
function getProperties(obj, type, enumerability) {
/**
* Return array of object properties
* @param {String} type - Property type. Can be "own", "nonown" or "both"
* @param {String} enumerability - Property enumerability. Can be "enum",
* "nonenum" or "both"
* @returns {String|Array} Array of properties
*/
var props = Object.create(null); // Dictionary
var firstIteration = true;
do {
var allProps = Object.getOwnPropertyNames(obj);
var enumProps = Object.keys(obj);
var nonenumProps = allProps.filter(x => !(new Set(enumProps)).has(x));
enumProps.forEach(function(prop) {
if (!(prop in props)) {
props[prop] = { own: firstIteration, enum_: true };
}
});
nonenumProps.forEach(function(prop) {
if (!(prop in props)) {
props[prop] = { own: firstIteration, enum_: false };
}
});
firstIteration = false;
} while (obj = Object.getPrototypeOf(obj));
for (prop in props) {
if (type == "own" && props[prop]["own"] == false) {
delete props[prop];
continue;
}
if (type == "nonown" && props[prop]["own"] == true) {
delete props[prop];
continue;
}
if (enumerability == "enum" && props[prop]["enum_"] == false) {
delete props[prop];
continue;
}
if (enumerability == "nonenum" && props[prop]["enum_"] == true) {
delete props[prop];
}
}
return Object.keys(props);
}
Вы можете попробовать создать новый массив colDef и передать его в параметры сетки.
Примерно так -
function updateColDef()
{
let newColDef= [];
this.gridColumns.forEach(function(colDef) {
colDef['menuTabs'] = ["generalMenuTab",columnsMenuTab"];
newColDef.push(colDef);
});
this.gridApi.api.setColumnDefs(newColDef);
this.gridApi.refreshHeader();
}
Аналогичная проблема , с которой столкнулся другой пользователь сетки ag