primeNG升级到8.0.1,加载数据表时出错

时间:2019-07-16 14:10:06

标签: angular primeng

我需要将我的primeng软件包从7升级到8。

我遇到以下错误:

anager-console / src / main / frontend / node_modules / primeng / primeng“'没有导出的成员'DataTable'

在组件文件中找不到以下导入

import { DataTable } from 'primeng/primeng';

package.json

"private": true,
  "dependencies": {
    "@angular/animations": "7.2.15",
    "@angular/cdk": "7.3.7",
    "@angular/common": "7.2.15",
    "@angular/compiler": "7.2.15",
    "@angular/core": "7.2.15",
    "@angular/forms": "7.2.15",
    "@angular/http": "7.2.15",
    "@angular/platform-browser": "7.2.15",
    "@angular/platform-browser-dynamic": "7.2.15",
    "@angular/router": "7.2.15",
    "@fortawesome/fontawesome-free": "^5.7.2",
    "bootstrap": "^3.4.1",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.6.5",
    "floatthead": "^2.1.3",
    "jquery": "^3.4.1",
    "jquery-ui-dist": "^1.12.1",
    "ng-treetable": "^1.3.3",
    "ngx-bootstrap": "^3.2.0",
    "primeicons": "^1.0.0",
    "primeng": "^8.0.1",
    "rxjs": "^6.4.0",
    "rxjs-compat": "^6.4.0",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.13.9",
    "@angular/cli": "7.3.9",
    "@angular/compiler-cli": "7.2.15",
    "@angular/language-service": "7.2.15",
    "@types/jasmine": "^2.8.16",
    "@types/jasminewd2": "^2.0.6",
    "@types/node": "^10.14.1",
    "codelyzer": "^5.0.1",
    "eslint": "^5.16.0",
    "jasmine-core": "~3.3.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.3",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~2.0.0",
    "karma-coverage-istanbul-reporter": "^2.0.5",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "^5.4.1",
    "ts-node": "~7.0.1",
    "tslint": "~5.16.0",
    "typescript": "3.1.6"
  }

更新

我确实将Angular更新为8,但仍然存在相同的问题。

进一步调查后,在primeNG 8中删除了DataTable组件。 我查看了发行说明,但是关于删除DataTable组件没有任何提及。现在,我需要找出我该用什么。.

link to primeNg issue

2 个答案:

答案 0 :(得分:0)

不推荐使用datatable,而推荐使用turbotable:

TurboTable
Table is the successor of p-dataTable with a lightning fast performance (at least 10x faster) and excellent level of control over the presentation. p-table is called as TurboTable in order to differantiate if from the deprecated p-dataTable.

https://www.primefaces.org/primeng-7.1.3/#/table

我链接到版本7,因为版本8甚至都不再显示弃用消息。

答案 1 :(得分:0)

全部替换了import { DataTable } from 'primeng/primeng'; 与导入{ Table } from 'primeng/table'; 解决了我的问题