swimlane / ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
http://swimlane.github.io/ngx-datatable/
MIT License
4.63k stars 1.68k forks source link

Type "checkbox" is not assignable to type SelectionType #1873

Open schnucks-rrphillips opened 4 years ago

schnucks-rrphillips commented 4 years ago

<ngx-datatable class="material" [rows]="deviceConfigList" [columnMode]="'force'" [headerHeight]="42" [footerHeight]="30" [sorts]="[{prop: 'deviceFunction', dir: 'asc'}]" [rowHeight]="75" [scrollbarV]="true" [selected]="selected" [selectionType]="'checkbox'" (select)='onSelect($event)'>

I'm submitting a ... (check one with "x")

[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 For the above code Angular 9 running in strict mode reports the type error: "Type '"checkbox"' is not assignable to type 'SelectionType'." Also, IntelliJ IDE detects the same error. As a result I cannot build this app in strict mode. It builds with fullTemplateTypeCheck enabled. The UI works as expected with this syntax.

ceoaliongroo commented 4 years ago

The same problem here Table version: "@swimlane/ngx-datatable": "16.0.2"

Angular version: Version 8.2.14

TypeScript version: TypeScript 3.5.3

How to fixed?

schnucks-rrphillips commented 4 years ago

I got it to work in ng9 strict mode by importing SelectionType...

import {DatatableComponent, SelectionType} from '@swimlane/ngx-datatable';

And using this syntax...

[selectionType]="SelectionType.checkbox"

vinayakshedgeri commented 3 years ago

Import it import { SelectionType } from '@swimlane/ngx-datatable';

Declare it

  selection: SelectionType;

initialize it constructor() { this.selection = SelectionType.checkbox; };