Skip to content

SortHeader indicator in an inactive MatTab seems broken #8856

Closed

Description

@lacolaco

Bug, feature request, or proposal:

Bug

What is the expected behavior?

MatSort works well in MatTab.

What is the current behavior?

Broken

image

What are the steps to reproduce?

Providing a StackBlitz/Plunker (or similar) is the best way to get the team to see your issue.

Plunker starter (using on @master): https://goo.gl/uDmqyY

StackBlitz starter (using latest npm release): https://goo.gl/wwnhMV

https://stackblitz.com/edit/angular-eaadrn?file=app%2Fsort-overview-example.html

What is the use-case or motivation for changing an existing behavior?

I want to put multiple tables in tabs. And they have to accept sort input from its parent.

<mat-tab-group>
	<mat-tab label="Table 1">
		<table-cmp [sort]="{id: 'name', start: 'desc'}"></table-cmp>
	</mat-tab>
	<mat-tab label="Table 2">
		<table-cmp [sort]="{id: 'calories', start: 'asc'}"></table-cmp>
	</mat-tab>
</mat-tab-group>

I tried to pass inputted sort property to MatSort#sort. Initial active tab's table is ok, but inactive tab's tables aren't.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 5.0
Material 5.0

Is there anything else we should know?

#8396 may be related.

Activity

  1. lacolaco commented on Dec 7, 2017

    @lacolaco
    ContributorAuthor

    BTW, I think matSort directive should accept default sorting configuration...

  2. andrewseguin commented on Dec 12, 2017

    @andrewseguin
    Contributor

    The directive does support a default sort config - use matSortActive and matSortDirection to signal the current sort.

    This issue is related to how Angular sets up content projected elements. You'll need to load the content of the tab asynchronously. See #8921 for the PR that will allow this. Unfortunately that the sort header cannot be changed to accommodate this.

    Closing since this is a duplicate of a couple open issues already that is related to the async tab problem

  3. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  4. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions