Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: disable column sorting on unsupported types #1390

Merged
merged 7 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/iris-grid/src/AdvancedFilterCreator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class AdvancedFilterCreator extends PureComponent<
);
this.valuesTablePromise
.then(valuesTable => {
if (valuesTable.columns[0].isSortable) {
if (valuesTable.columns[0].isSortable ?? false) {
const sort = valuesTable.columns[0].sort().asc();
valuesTable.applySort([sort]);
}
Expand Down Expand Up @@ -385,7 +385,7 @@ class AdvancedFilterCreator extends PureComponent<
*/
sortTable(direction: SortDirection, addToExisting = false): void {
const { column, onSortChange } = this.props;
if (column.isSortable) {
if (column.isSortable ?? false) {
onSortChange(column, direction, addToExisting);
}
}
Expand Down Expand Up @@ -568,7 +568,7 @@ class AdvancedFilterCreator extends PureComponent<
onClick={this.handleSortDown}
icon={dhSortAmountDown}
tooltip={`Sort ${column.name} Descending`}
disabled={!column.isSortable}
disabled={!(column.isSortable ?? false)}
/>
<Button
kind="ghost"
Expand All @@ -580,7 +580,7 @@ class AdvancedFilterCreator extends PureComponent<
<FontAwesomeIcon icon={dhSortAmountDown} rotation={180} />
}
tooltip={`Sort ${column.name} Ascending`}
disabled={!column.isSortable}
disabled={!(column.isSortable ?? false)}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
model.getColumnHeaderParentGroup(modelIndex, 0) === undefined &&
!(isExpandableGridModel(model) && model.hasExpandableRows);
const isColumnFrozen = model.isColumnFrozen(modelIndex);
const isColumnSortable = column.isSortable;
const isColumnSortable = column.isSortable ?? false;
ethanalvizo marked this conversation as resolved.
Show resolved Hide resolved
actions.push({
title: 'Hide Column',
group: IrisGridContextMenuHandler.GROUP_HIDE_COLUMNS,
Expand Down