parentFilter - declarative support

This commit is contained in:
Jan Prochazka
2022-08-07 18:12:10 +02:00
parent 5418bb932c
commit 1731b7e4a3
6 changed files with 61 additions and 1 deletions

View File

@@ -212,6 +212,32 @@
});
}
console.log('tableNode?.supportsParentFilter', tableNode?.supportsParentFilter);
if (tableNode?.supportsParentFilter) {
const isParentFilter = (config.parentFilters || []).find(x => x.uniqueName == tableNode.uniqueName);
if (isParentFilter) {
res.push({
text: 'Cancel filter parent rows',
onClick: () => {
setConfig(cfg => ({
...cfg,
parentFilters: cfg.parentFilters.filter(x => x.uniqueName != tableNode.uniqueName),
}));
},
});
} else {
res.push({
text: 'Filter parent rows',
onClick: () => {
setConfig(cfg => ({
...cfg,
parentFilters: [...(cfg.parentFilters || []), { uniqueName: tableNode.uniqueName }],
}));
},
});
}
}
const rowIndex = tr?.getAttribute('data-rowIndex');
if (rowIndex != null) {
const value = display.rows[rowIndex].rowData[columnIndex];