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

Pass extra columns as input to table + columns optional initial order #1721

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

duredhel13
Copy link
Contributor

@duredhel13 duredhel13 commented Jul 13, 2019

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

The dynamic addition of columns doesn't work out of the box. This is useful for reusability of a certain table, with the ability to add more columns.

What is the new behavior?

Users can pass extra columns to the table via @Input() in the form of a QueryList<DataTableColumnDirective>. Users can also define an initial order for columns to override the initial position where they will be rendered.

Refer to Docs/Basic/Reusability for examples on how to use this new functionality.

Please note that Angular does not currently support content projection for multiple levels of components. So it is necessary to pass the columns via @Input(). This issue is tracked here: https://github.com/angular/angular/issues/8563.

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

@duredhel13 duredhel13 requested review from marjan-georgiev and Hypercubed and removed request for marjan-georgiev and Hypercubed July 13, 2019 22:56
@duredhel13 duredhel13 marked this pull request as ready for review July 14, 2019 16:33
})
export class ReusabilityComponent {
rows = [];

Choose a reason for hiding this comment

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

Is it really reusable when you are hard-coding the column values at component level.
The reason i said this because i tried using the same thing but the passing the data via @input property and it throws error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The columns passed via @input need to be of type QueryList<DataTableColumnDirective>, I assume it will fail any other way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants