이 컨트롤은 더 이상 사용되지 않고 그리드로 대체되었으므로 해당 컨트롤로 마이그레이션하는 것이 좋습니다. 새로운 기능은 제공되지 않으며 버그 수정은 우선순위에서 제외됩니다. 코드베이스를 Data Grid로 마이그레이션하는 데 도움이 필요하거나 질문이 있으면 지원팀에 문의하세요.

    Web Components 데이터 그리드 개요

    Ignite UI for Web Components Data Table/Data Grid는 코딩이나 구성이 거의 없이 데이터를 빠르게 바인딩하고 표시할 수 있는 표형 Web Components 그리드 구성 요소입니다. Web Components 데이터 그리드의 기능에는 필터링, 정렬, 템플릿, 행 선택, 행 그룹화, 행 고정 및 이동 가능한 열이 포함됩니다. Web Components 테이블은 라이브 스트리밍 데이터에 최적화되어 있으며 행 또는 열 수에 제한이 없는 데이터 세트 크기를 처리할 수 있습니다.

    Web Components 데이터 그리드 예제

    이 데모는 그리드에서 사용할 수 있는 일부 기능(필터링, 그룹화, 열 고정/고정 해제, 열 위치 변경, 정렬 및 요약)을 구현합니다.

    EXAMPLE
    DATA
    TS
    HTML
    CSS

    이 샘플이 마음에 드시나요? 당사의 완전한 Ignite UI for Web Components 툴킷에 액세스하여 몇 분 만에 나만의 앱을 빌드하기 시작하세요. 무료로 다운로드하세요.

    시작하기

    종속성

    Web Components 그리드 패키지를 설치할 때 핵심 패키지도 설치해야 합니다.

    npm install --save igniteui-webcomponents-core
    npm install --save igniteui-webcomponents-grids
    npm install --save igniteui-webcomponents-inputs
    cmd

    컴포넌트 모듈

    IgcGridComponent 에는 다음 모듈이 필요합니다.

    import { ModuleManager } from 'igniteui-webcomponents-core';
    import { IgcDataGridModule } from 'igniteui-webcomponents-grids';
    import { IgcDataGridComponent } from 'igniteui-webcomponents-grids';
    
    ModuleManager.register(
        IgcDataGridModule
    );
    ts

    옵션 모듈

    위에 표시된 선택적 IgcGridComponent 기능에는 다음 모듈이 필요합니다.

    import { IgcGridColumnOptionsModule } from 'igniteui-webcomponents-grids';
    import { IgcGridColumnOptionsComponent } from 'igniteui-webcomponents-grids';
    import { IgcDataGridToolbarModule } from 'igniteui-webcomponents-grids';
    import { IgcDataGridToolbarComponent } from 'igniteui-webcomponents-grids';
    import { IgcSparklineModule } from 'igniteui-webcomponents-charts';
    import { IgcSparklineComponent } from 'igniteui-webcomponents-charts';
    
    ModuleManager.register(
        IgcGridColumnOptionsModule,
        IgcDataGridToolbarModule,
        IgcSparklineModule
    );
    ts

    샘플 데이터 소스

    이제 Web Components 데이터 그리드 모듈을 가져왔으므로 다음은 로컬 데이터에 바인딩되는 Web Components 그리드의 기본 구성입니다.

        this.data = [{
            Discontinued: false,
            OrderDate: new Date("2012-02-12"),
            ProductID: 1,
            ProductName: "Chai",
            QuantityPerUnit: "10 boxes x 20 bags",
            ReorderLevel: 10,
            UnitPrice: 18.0000,
            UnitsInStock: 39
        }, {
            Discontinued: false,
            OrderDate: new Date("2003-03-17"),
            ProductID: 2,
            ProductName: "Chang",
            QuantityPerUnit: "24 - 12 oz bottles",
            ReorderLevel: 25,
            UnitPrice: 19.0000,
            UnitsInStock: 17
        }, {
            Discontinued: false,
            OrderDate: new Date("2006-03-17"),
            ProductID: 3,
            ProductName: "Aniseed Syrup",
            QuantityPerUnit: "12 - 550 ml bottles",
            ReorderLevel: 25,
            UnitPrice: 10.0000,
            UnitsInStock: 13
        }, {
            Discontinued: false,
            OrderDate: new Date("2016-03-17"),
            ProductID: 4,
            ProductName: "Chef Antony Cajun Seasoning",
            QuantityPerUnit: "48 - 6 oz jars",
            ReorderLevel: 0,
            UnitPrice: 22.0000,
            UnitsInStock: 53
        }, {
            Discontinued: true,
            OrderDate: new Date("2011-11-11"),
            ProductID: 5,
            ProductName: "Chef Antony Gumbo Mix",
            QuantityPerUnit: "36 boxes",
            ReorderLevel: 0,
            UnitPrice: 21.3500,
            UnitsInStock: 0
        }];
    ts

    열 자동 생성

    다음 코드는 Web Components 데이터 그리드를 위의 로컬 데이터에 바인딩하는 방법을 보여줍니다.

    <igc-data-grid id="grid"
          height="100%"
          width="100%"
          auto-generate-columns="true"
          default-column-min-width="100"
          summary-scope="Root"
          is-column-options-enabled="true"
          is-group-collapsable="true"
          group-summary-display-mode="RowBottom"
          column-moving-mode="Deferred"
          column-moving-animation-mode="SlideOver"
          column-moving-separator-width="2"
          column-showing-animation-mode="slideFromRightAndFadeIn"
          column-hiding-animation-mode="slideToRightAndFadeOut"
          selection-mode="SingleRow"
          corner-radius-top-left="0"
          corner-radius-top-right="0">
    </igc-data-grid>
    html
    let grid1 = (document.getElementById("grid") as IgcDataGridComponent);
    grid1.dataSource = data;
    ts

    수동으로 열 정의

    <igc-data-grid id="grid"
        width="100%"
        height="500px"
        auto-generate-columns="false">
            <igc-numeric-column field="ProductID" header-text="Product ID"></igc-numeric-column>
            <igc-text-column field="ProductName" header-text="Product Name"></igc-text-column>
            <igc-text-column field="QuantityPerUnit" header-text="Quantity Per Unit"></igc-text-column>
            <igc-numeric-column field="UnitsInStock" header-text="Units In Stock"></igc-numeric-column>
            <igc-date-time-column field="OrderDate" header-text="Order Date"></igc-date-time-column>
    </igc-data-grid>
    html
    let grid1 = (document.getElementById("grid") as IgcDataGridComponent);
    grid1.dataSource = data;
    ts

    열 스타일 지정

    다음 코드는 제공된 열의 속성을 사용하여 특정 열의 스타일을 지정하는 방법을 보여줍니다.

    <igc-text-column
        background="SkyBlue"
        text-style="Italic Bold 16pt Times New Roman"
    ></igc-text-column>
    html
    Ignite UI for Web Components | CTA 배너

    추가 리소스

    API 참조