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

headerHeight=auto throwing build time error. Working fine while development. #2048

Open
shabbirdhangot opened this issue Nov 24, 2021 · 1 comment · May be fixed by #2111
Open

headerHeight=auto throwing build time error. Working fine while development. #2048

shabbirdhangot opened this issue Nov 24, 2021 · 1 comment · May be fixed by #2111

Comments

@shabbirdhangot
Copy link

I'm submitting a ...

[ X ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior

Setting headerHeight auto working in the dev environment (ng serve) but throwing error while production build (ng build --prod)

 Type 'string' is not assignable to type 'number'.  

 <ngx-datatable class="material" columnMode="force" headerHeight="auto" [footerHeight]="0" rowHeight="auto"

Expected behavior

It should work in both environment.

What is the motivation / use case for changing the behavior?

I have long header for my table. In that case headerHeight auto is best option for me.

Please tell us about your environment:

  • Table version:
  • 20.0.0
  • Angular version:
  • 12.2.12
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

-all

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
  • all
@BEagle1984
Copy link

The headerHeight property is declared as number only.

But later in the code it is compared against the "auto" string and that's therefore a valid value.

get isFixedHeader(): boolean {
const headerHeight: number | string = this.headerHeight;
return typeof headerHeight === 'string' ? <string>headerHeight !== 'auto' : true;
}

It should be declared like the rowHeight property, so:"

  @Input() headerHeight: number | 'auto' | ((row?: any) => number) = 30;

Dropping a PR...

@BEagle1984 BEagle1984 linked a pull request Oct 13, 2022 that will close this issue
9 tasks
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 a pull request may close this issue.

2 participants