2017-04-19 11 views
0

package.jsonで依存関係のリストに次の2行は、データグリッドテンプレート角度2.4.1バージョンに適した角度データグリッドが見つかりませんか?

上記の2行を取得したい追加したことを実行NPMがダウンロードしてインストールした後、AG-グリッドに関連する依存関係を追加します。 はその後、エラー"cannot find module angular2/core"の取得データグリッド

import {Component} from 'angular2/core'; 
import {AgGridNg2} from 'ag-grid-ng2/main'; 

@Component({ 
    selector: 'my-datatable', 
    directives: [AgGridNg2], 
    template: ` 
     <ag-grid-ng2 #agGrid style="height:100%;width:845px" class="ag-fresh" 
      [gridOptions]="gridOptions"> 
     </ag-grid-ng2 > 
    ` 
}) 

export class AppComponent { 
    myRowData = [ 
     {"name":"Ronald Bowman","country":"China","city":"Lutou","email":"[email protected]"}, 
     {"name":"Pamela Hill","country":"Russia","city":"Krylovskaya","email":"[email protected]"}, 
     {"name":"Robin Andrews","country":"Ukraine","city":"Korop","email":"[email protected]"}, 
     {"name":"Peter Kim","country":"Mexico","city":"San Jose","email":"[email protected]"}, 
     {"name":"Carol Foster","country":"Mexico","city":"El Aguacate","email":"[email protected]"}, 
     {"name":"Jimmy Burke","country":"Indonesia","city":"Banjarsari","email":"[email protected]"}, 
     {"name":"Jonathan Crawford","country":"Peru","city":"Alca","email":"[email protected]"}, 
     {"name":"Donald Montgomery","country":"Poland","city":"Działoszyce","email":"dmontgomery[email protected]"}, 
     {"name":"Donna Shaw","country":"Japan","city":"Akune","email":"[email protected]"}, 
     {"name":"Helen King","country":"United States","city":"Hollywood","email":"[email protected]"}, 
     {"name":"Walter Myers","country":"China","city":"a ndaowa n", "email":"[email protected]"}, 
     {"name":" Alice Collins","country":"Papua Nw Guine a", "city":"Mendi","email":"[email protected]"}, 
     {"name":"Anne Richards","country":"China","city":"Koramlik","email":"[email protected]"}, 
     {"name":"Randy Miller","country":"Indonesia","city":"Trenggulunan","email":"[email protected]"}, 
     {"name":"Phillip Adams","country":"Bahamas","city":"Duncan Town","email":"[email protected]"}, 
     {"name":"Nicholas Allen","country":"Philippines","city":"Bautista","email":"[email protected]"}, 
     {"name":"Lisa Willis","country":"Thailand","city":"Lat Yao","email":"[email protected]"}, 
     {"name":"Jeffrey Castillo","country":"Indonesia","city":"Karangsari","email":"[email protected]"}, 
     {"name":"Michael Carpenter","country":"Colombia","city":"Cali","email":"[email protected]"}, 
     {"name":"Roger Lee","country":"France","city":"Courtaboeuf","email":"[email protected]"}, 
     {"name":"Steve Wallace","country":"Russia","city":"Novobeysugskaya","email":"[email protected]"}, 
     {"name":"Shirley Patterson","country":"Peru","city":"La Tinguiña","email":"[email protected]"}, 
     {"name":"Nancy Ward","country":"Sweden","city":"Båstad","email":"[email protected]"} 
    ]; 

    columnDefs = [ 
     {headerName: 'Name', field: "name", width: 200 }, 
     {headerName: 'Country', field: "country" ,width:180}, 
     {headerName: 'City', field: "city" ,width:160}, 
     {headerName: 'e-mail', field: "email" ,width:300} 
    ]; 

    gridOptions = []; 

    constructor() { 
     this.gridOptions = { 
      rowData: this.myRowData, 
      columnDefs: this.columnDefs, 
      enableColResize: true, 
      enableSorting: true, 
      enableFilter: true 
     } 
    } 
} 

用コンポーネントにコードを追加しました。しかし、私は互換性のないバージョンが..角度の2.4.1バージョンと互換性のある任意のデータグリッドがあることを発見しました。

+0

あなたは試したことがありhttps://material.angular.io/components/component/grid-listまたはhttps://www.primefaces.org/primeng/#/datatable –

答えて

0

primeng datatableを使ってみましたか?

filter、crud、templatingのような優れた機能がよく文書化されています。

https://www.primefaces.org/primeng/#/datatable

+0

我々は追加する必要がありますかそれは依存関係にあり、角度2.4.1のバージョン –

+0

npm install primeng --saveと互換性があるかどうか。 https://www.primefaces.org/primeng/#/setupこれはインストールです。はい、それは2.4.1と互換性があります。 primengは初期開発から始まって以来最高のものになるでしょう注:インストールは自動的に依存関係を追加すべきです –

関連する問題