Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanalvizo committed Jul 5, 2023
1 parent 00de9ce commit a6b9e03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/iris-grid/src/AdvancedFilterCreator.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function makeAdvancedFilterCreatorWrapper(
selectedValues: [],
},
model: irisGridTestUtils.makeModel(),
column: irisGridTestUtils.makeColumn(),
column: irisGridTestUtils.makeColumn('0'), // needs to match column name in makeModel so that columnIndex can be found when rendering
formatter: new Formatter(dh),
}
) {
Expand Down
6 changes: 1 addition & 5 deletions packages/iris-grid/src/AdvancedFilterCreator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ class AdvancedFilterCreator extends PureComponent<
);
this.valuesTablePromise
.then(valuesTable => {
const columnIndex = model.getColumnIndexByName(
valuesTable.columns[0].name
);
assertNotNull(columnIndex);
if (model.isColumnSortable(columnIndex)) {
if (valuesTable.columns[0].isSortable ?? true) {
const sort = valuesTable.columns[0].sort().asc();
valuesTable.applySort([sort]);
}
Expand Down
17 changes: 9 additions & 8 deletions packages/iris-grid/src/IrisGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2401,16 +2401,17 @@ export class IrisGrid extends Component<IrisGridProps, IrisGridState> {
log.info('Toggling sort for column', columnIndex);

const { model } = this.props;
const { sorts: currentSorts } = this.state;
const modelColumn = this.getModelColumn(columnIndex);
assertNotNull(modelColumn);
const sorts = TableUtils.toggleSortForColumn(
currentSorts,
model.columns,
modelColumn,
addToExisting
);
if (model.columns[columnIndex].isSortable ?? false) {
if (model.isColumnSortable(columnIndex)) {
const { sorts: currentSorts } = this.state;
const sorts = TableUtils.toggleSortForColumn(
currentSorts,
model.columns,
modelColumn,
addToExisting
);

this.updateSorts(sorts);
} else {
log.debug('Column type was not sortable', model.columns[columnIndex]);
Expand Down

0 comments on commit a6b9e03

Please sign in to comment.