(core) Adding hide for multiple columns

Summary: New column menu option to hide multiple columns.

Test Plan: new test

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3581
This commit is contained in:
Jarosław Sadziński
2022-08-17 22:09:03 +02:00
parent 360d838578
commit 758c87f002
3 changed files with 10 additions and 10 deletions

View File

@@ -305,7 +305,7 @@ GridView.gridCommands = {
insertFieldBefore: function() { this.insertColumn(this.cursor.fieldIndex()); },
insertFieldAfter: function() { this.insertColumn(this.cursor.fieldIndex() + 1); },
renameField: function() { this.currentEditingColumnIndex(this.cursor.fieldIndex()); },
hideField: function() { this.hideField(this.cursor.fieldIndex()); },
hideFields: function() { this.hideFields(this.getSelection()); },
deleteFields: function() { this.deleteColumns(this.getSelection()); },
clearValues: function() { this.clearValues(this.getSelection()); },
clearColumns: function() { this._clearColumns(this.getSelection()); },
@@ -723,10 +723,10 @@ GridView.prototype.deleteColumns = function(selection) {
}
};
GridView.prototype.hideField = function(index) {
var field = this.viewSection.viewFields().at(index);
var action = ['RemoveRecord', field.id()];
return this.gristDoc.docModel.viewFields.sendTableAction(action);
GridView.prototype.hideFields = function(selection) {
var actions = selection.fields.map(field => ['RemoveRecord', field.id()]);
return this.gristDoc.docModel.viewFields.sendTableActions(actions, `Hide columns ${actions.map(a => a[1]).join(', ')} ` +
`from ${this.tableModel.tableData.tableId}.`);
};
GridView.prototype.moveColumns = function(oldIndices, newIndex) {

View File

@@ -348,9 +348,9 @@ exports.groups = [{
keys: ['Ctrl+m'],
desc: 'Rename the currently selected column'
}, {
name: 'hideField',
name: 'hideFields',
keys: ['Alt+Shift+-'],
desc: 'Hide the currently selected column'
desc: 'Hide currently selected columns'
}, {
name: 'toggleFreeze',
keys: [],