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(sort): add the ability to disable sort toggling #8643

Merged
merged 1 commit into from
Dec 1, 2017

Conversation

crisbeto
Copy link
Member

Adds the ability for a mat-sort-header or mat-sort instance to be disabled, preventing the user from changing the sorting direction.

Fixes #8622.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 25, 2017
},
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
inputs: ['disabled: matSortHeaderDisabled'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be disabled

Copy link
Member Author

@crisbeto crisbeto Nov 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't go with disabled, because while it is a component, the selector is still an attribute so it's not super obvious what you're disabling.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, just a funny consequence of our rules - might loop in @jelbourn for confirmation on this but as a rule, components don't prefix

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be just disabled because the selector is dash-case (matches mat-button and mat-tab-nav-bar). It's only when the selector is camelCase that inputs should be prefixed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched it to disabled @andrewseguin.

@andrewseguin
Copy link
Contributor

There's an open PR similar to this (#7786) but yours includes a way to disable the MatSort so let's go with that.

Adds the ability for a `mat-sort-header` or `mat-sort` instance to be disabled, preventing the user from changing the sorting direction.

Fixes angular#8622.
@andrewseguin andrewseguin added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Nov 27, 2017
@andrewseguin
Copy link
Contributor

LGTM

@mdrafee03
Copy link

apply with mat-sort-header, [disabled] = "condition to be true"
Example
<mat-header-cell *matHeaderCellDef mat-sort-header [disabled]="!sortedColumns.includes(col)"> {{ helper.extract(labels, col) }} </mat-header-cell>

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Sort] Add disable input
6 participants