Skip to content

Commit 205abbd

Browse files
committed
Disable Search Bar, Download CSV, Sort, Filter on non-row columns
1 parent be0387a commit 205abbd

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

packages/iris-grid/src/IrisGridSimplePivotModel.ts

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,24 @@ const GRAND_TOTAL_VALUE = 'Grand Total';
4646
// - totals row formatting [DONE]
4747
// - totals row: copy cell unformatted [DONE]
4848
// - copy selection with headers - fix column mapping, fix case with only totals row selected [DONE]
49-
// - ^ unit tests
50-
// - totals column move to back
51-
// - col based operations - save/restore settings on model change
52-
// - flags to hide unsupported table options - go to row, filters, search, organize columns, etc
49+
// - fix Grand Total text in non-string columns [DONE]
50+
// - disable sort on col columns [DONE]
51+
// - disable filters, advanced filters on col columns [DONE]
52+
// - disable Search Bar [DONE]
53+
// - disable Download CSV [DONE]
54+
55+
// - disable Organize columns
56+
// - disable Go to row
57+
5358
// - fix sub/unsubscribe on model change
59+
// - totals column move to back
60+
61+
// - DH.UI example with selectable aggregation functions
62+
63+
// - column order, column resize, visibility, etc -- save/restore settings on model change (or disable?)
64+
// - if the above works, enable sorting, filtering, etc.
65+
66+
// - ^ unit tests
5467

5568
/**
5669
* Model which proxies calls to IrisGridModel.
@@ -247,6 +260,14 @@ class IrisGridSimplePivotModel extends IrisGridModel {
247260
return false;
248261
}
249262

263+
isFilterable(columnIndex: ModelIndex): boolean {
264+
return columnIndex < this.schema.rowColNames.length;
265+
}
266+
267+
isColumnSortable(columnIndex: ModelIndex): boolean {
268+
return columnIndex < this.schema.rowColNames.length;
269+
}
270+
250271
get isTotalsAvailable(): boolean {
251272
// Hide Aggregate Columns option in Table Settings
252273
return false;
@@ -256,6 +277,11 @@ class IrisGridSimplePivotModel extends IrisGridModel {
256277
return false;
257278
}
258279

280+
get isExportAvailable(): boolean {
281+
// table.freeze is available, but exporting requires extra logic for column mapping and totals rows
282+
return false;
283+
}
284+
259285
get isCustomColumnsAvailable(): boolean {
260286
return false;
261287
}
@@ -302,6 +328,13 @@ class IrisGridSimplePivotModel extends IrisGridModel {
302328
return this.model.valueForCell(x, y);
303329
}
304330

331+
textForCell(x: ModelIndex, y: ModelIndex): string {
332+
return this.schema.hasTotals && y === this.rowCount - 1 && x === 0
333+
? GRAND_TOTAL_VALUE
334+
: // Pass the context so model.textForCell calls this.valueForCell instead of model.valueForCell
335+
this.model.textForCell.call(this, x, y);
336+
}
337+
305338
setTotalsTable(totalsTable: DhType.Table | null): void {
306339
log.debug('setTotalsTable', totalsTable);
307340

@@ -475,6 +508,7 @@ class IrisGridSimplePivotModel extends IrisGridModel {
475508
columnGroups: [],
476509
areSavedLayoutsAllowed: false,
477510
frontColumns: [],
511+
searchDisplayMode: this.dh.SearchDisplayMode.SEARCH_DISPLAY_HIDE,
478512
};
479513
}
480514

packages/iris-grid/src/mousehandlers/IrisGridContextMenuHandler.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
277277
action: () => {
278278
this.irisGrid.handleAdvancedMenuOpened(visibleIndex);
279279
},
280+
disabled: !model.isFilterable(modelIndex),
280281
});
281282
actions.push({
282283
title: 'Clear Table Filters',

0 commit comments

Comments
 (0)