mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Allow filtering hidden columns
Summary: Existing filters are now moved out of fields and into a new metadata table for filters, and the client is updated to retrieve/update/save filters from the new table. This enables storing of filters for columns that don't have fields (notably, hidden columns). Test Plan: Browser and server tests. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D3138
This commit is contained in:
@@ -576,29 +576,34 @@ ViewConfigTab.prototype._buildFilterDom = function() {
|
||||
}
|
||||
|
||||
return [
|
||||
grainjsDom.forEach(section.filteredFields, (field) => {
|
||||
grainjsDom.forEach(section.activeFilters, (filterInfo) => {
|
||||
return cssRow(
|
||||
cssIconWrapper(
|
||||
cssFilterIcon('FilterSimple', cssNoMarginLeft.cls('')),
|
||||
attachColumnFilterMenu(section, field, {
|
||||
attachColumnFilterMenu(section, filterInfo, {
|
||||
placement: 'bottom-end', attach: 'body',
|
||||
trigger: ['click', (_el, popupControl) => popupControls.set(field, popupControl)],
|
||||
trigger: [
|
||||
'click',
|
||||
(_el, popupControl) => popupControls.set(filterInfo.fieldOrColumn.origCol(), popupControl)
|
||||
],
|
||||
}),
|
||||
),
|
||||
cssLabel(grainjsDom.text(field.label)),
|
||||
cssLabel(grainjsDom.text(filterInfo.fieldOrColumn.label)),
|
||||
cssIconWrapper(
|
||||
cssFilterIcon('Remove', dom.on('click', () => field.activeFilter('')),
|
||||
testId('remove-filter')),
|
||||
cssFilterIcon('Remove',
|
||||
dom.on('click', () => section.setFilter(filterInfo.fieldOrColumn.origCol().origColRef(), '')),
|
||||
testId('remove-filter')
|
||||
),
|
||||
),
|
||||
testId('filter'),
|
||||
);
|
||||
}),
|
||||
cssRow(
|
||||
grainjsDom.domComputed((use) => {
|
||||
const fields = use(use(section.viewFields).getObservable());
|
||||
const filters = use(section.filters);
|
||||
return cssTextBtn(
|
||||
cssPlusIcon('Plus'), 'Add Filter',
|
||||
addFilterMenu(fields, popupControls, {placement: 'bottom-end'}),
|
||||
addFilterMenu(filters, section, popupControls, {placement: 'bottom-end'}),
|
||||
testId('add-filter-btn'),
|
||||
);
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user