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

Feature/SURVEY-17202 add ability to switch off column sorting for a whole table. #329

Merged
merged 1 commit into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion src/components/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,9 @@ export const Grid = ({
columnDefs.map((colDef) => ({
...colDef,
suppressSizeToFit: (sizeColumns === "auto" || sizeColumns === "auto-skip-headers") && !colDef.flex,
sortable: colDef.sortable && params.defaultColDef?.sortable !== false,
})),
[columnDefs, sizeColumns],
[columnDefs, params.defaultColDef?.sortable, sizeColumns],
);

/**
Expand Down
13 changes: 7 additions & 6 deletions src/contexts/GridContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,19 +384,20 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: GridCont
const colDef = gridApi.getColumnDef(colId);
if (!colDef) return;

// Cell already being edited, so don't re-edit until finished
if (checkUpdating([colDef.field ?? ""], rowId)) {
return;
}
prePopupOps();
const rowNode = gridApi.getRowNode(`${rowId}`);
if (!rowNode) {
return;
}

if (!rowNode.isSelected()) {
rowNode.setSelected(true, true);
rowNode.setSelected(true, false);
}

// Cell already being edited, so don't re-edit until finished
if (checkUpdating([colDef.field ?? ""], rowId)) {
return;
}
prePopupOps();

const rowIndex = rowNode.rowIndex;
if (rowIndex != null) {
Expand Down