Skip to content

Commit

Permalink
[core] fix remove column pinning position of desired order
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffrey Hervet committed May 17, 2024
1 parent afc0a85 commit 4a7b2ac
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,18 @@ export const createColumnsState = ({
};
} else {
const currentState = gridColumnsStateSelector(apiRef.current.state);

const pinnedColumns = apiRef.current.state.pinnedColumns;
// Remove pinned columns
const desiredOrderedFields = currentState.orderedFields.filter(field => {
return !(pinnedColumns.left?.includes(field) || pinnedColumns.right?.includes(field))
});

columnsState = {
orderedFields: keepOnlyColumnsToUpsert ? [] : [...currentState.orderedFields],
lookup: { ...currentState.lookup }, // Will be cleaned later if keepOnlyColumnsToUpsert=true
columnVisibilityModel,
desiredOrderedFields: currentState.orderedFields, // Will be cleaned later
desiredOrderedFields, // Will be cleaned later
};
}

Expand Down

0 comments on commit 4a7b2ac

Please sign in to comment.