React Grid Toolbar

    의 Ignite UI for React React Grid의 UI 작업을 위한 컨테이너입니다. React 툴바는 React 컴포넌트, 즉 IgrGrid의 상단에 위치하며 가로 크기와 일치합니다. 도구 모음 컨테이너는 사용자 정의 컨텐츠 또는 사전 정의된 UI 컨트롤 세트를 호스팅할 수 있습니다. React Grid의 기본 세트에는 다음이 포함됩니다.

    • 열 숨기기
    • 열 고정
    • 엑셀 내보내기
    • 고급 필터링

    도구 모음과 사전 정의된 UI 구성 요소는 React 이벤트를 지원하고 개발자를 위한 API를 노출합니다.

    React Toolbar Grid Example

    사전 정의된 Actionstitle UI 구성 요소는 IgrGridToolbar 내부에 추가되며 해당 그리드 기능과의 기본 상호 작용을 제공하는 도구 모음을 갖는 데 모두 필요합니다.

    <IgrGrid>
        <IgrGridToolbar key="toolbar">
            <IgrGridToolbarTitle key="toolbarTitle">
                <span key="toolbarTitleText">Grid Toolbar<span>
            </IgrGridToolbarTitle>
            <IgrGridToolbarActions key="toolbarActions">
                <IgrGridToolbarAdvancedFiltering key="advancedFiltering"></IgrGridToolbarAdvancedFiltering>
                <IgrGridToolbarPinning key="pinning"></IgrGridToolbarPinning>
                <IgrGridToolbarHiding key="hiding"></IgrGridToolbarHiding>
                <IgrGridToolbarExporter key="export"></IgrGridToolbarExporter>
            </IgrGridToolbarActions>
        </IgrGridToolbar>
    </IgrGrid>
    

    [!Note] As seen in the code snippet above, the predefined Actions UI components are wrapped in the IgrGridToolbarActions container. This way, the toolbar title is aligned to the left of the toolbar and the actions are aligned to the right of the toolbar.

    물론, 각 UI는 서로 독립적으로 추가될 수도 있고 전혀 추가되지 않을 수도 있습니다. 이렇게 하면 도구 모음 컨테이너가 비어 있게 렌더링됩니다.

    <IgrGrid>
        <IgrGridToolbar key="toolbar">
        </IgrGridToolbar>
    </IgrGrid>
    

    각 기본 UI 구성 요소를 포괄적으로 살펴보려면 아래 기능 섹션을 계속 읽어보세요.

    Features

    도구 모음은 그리드 전체에 영향을 미치는 논리/상호 작용을 분리하는 데 유용합니다.

    위에 표시된 대로 그리드에서 데이터 제어, 열 숨기기, 열 고정, 고급 필터링 및 내보내기를 위한 기본 구성 요소를 제공하도록 구성할 수 있습니다.

    이러한 기능은 Ignite UI for React의 카드 구성 요소와 유사한 패턴을 따르면 서로 독립적으로 활성화될 수 있습니다.

    아래에는 도구 모음의 주요 기능과 각 기능에 대한 예제 코드가 나열되어 있습니다.

    Title

    IgrGridToolbarTitle 사용하여 그리드의 도구 모음 제목을 설정합니다.

    사용자는 간단한 텍스트부터 보다 복잡한 템플릿까지 무엇이든 제공할 수 있습니다.

    <IgrGridToolbar key="toolbar">
        <IgrGridToolbarTitle key="toolbarTitle">
            <span key="toolbarTitleText">Grid toolbar title<span>
        </IgrGridToolbarTitle>
    </IgrGridToolbar>
    

    Actions

    IgrGridToolbarActions는 사용자가 상위 그리드와 관련하여 작업/상호 작용을 배치할 수 있는 곳입니다. 도구 모음의 제목 부분과 마찬가지로 사용자는 기본 도구 모음 상호 작용 구성 요소를 포함하여 해당 템플릿 부분 내에 무엇이든 제공할 수 있습니다.

    <IgrGridToolbar key="toolbar">
        <IgrGridToolbarActions key="toolbarActions">
    
        </IgrGridToolbarActions>
    </IgrGridToolbar>
    

    열 고정

    IgrGridToolbarPinning 구성 요소는 그리드의 열 고정과 상호 작용하기 위한 기본 UI를 제공합니다.

    구성 요소는 구성 요소 제목, 구성 요소 입력을 위한 자리 표시자 및 드롭다운 자체의 높이와 같은 UI 사용자 정의를 위한 여러 입력 속성뿐만 아니라 도구 모음이 포함된 상위 그리드를 사용하여 즉시 작동하도록 설정됩니다.

    <IgrGridToolbar key="toolbar">
        <IgrGridToolbarActions key="toolbarActions">
            <IgrGridToolbarPinning key="pinning" title="Grid pinned columns" prompt="Filter column collection" columnListHeight="400px"></IgrGridToolbarPinning>
        </IgrGridToolbarActions>
    </IgrGridToolbar>
    

    열 숨기기

    IgrGridToolbarHiding은 열 숨기기와 상호작용하기 위한 기본 UI를 제공합니다. 구성 요소 제목, 구성 요소 입력을 위한 자리 표시자, 드롭다운 자체의 높이 등 UI 사용자 지정을 위한 동일한 입력 속성을 노출합니다.

    <IgrGridToolbar key="toolbar">
        <IgrGridToolbarActions key="toolbarActions">
            <IgrGridToolbarHiding key="hiding" title="Grid column hiding" prompt="Filter column collection" columnListHeight="400px"></IgrGridToolbarHiding>
        </IgrGridToolbarActions>
    </IgrGridToolbar>
    

    고급 필터링

    도구 모음 고급 필터링 구성 요소는 고급 필터링 기능을 위한 기본 UI를 제공합니다. 구성 요소는 버튼의 기본 텍스트를 변경하는 방법을 노출합니다.

    <IgrGridToolbar key="toolbar">
        <IgrGridToolbarActions key="toolbarActions">
            <IgrGridToolbarAdvancedFiltering key="advancedFiltering"></IgrGridToolbarAdvancedFiltering>
        </IgrGridToolbarActions>
    </IgrGridToolbar>
    

    Data Exporting

    나머지 도구 모음 작업과 마찬가지로 내보내기는 기본적으로 IgrGridToolbarExporter를 통해 제공됩니다.

    도구 모음 내보내기 구성 요소는 UI와 내보내기 환경을 모두 사용자 지정하기 위한 여러 입력 속성을 노출합니다.

    표시 텍스트 변경부터 드롭다운 옵션 활성화/비활성화, 생성된 파일 이름 사용자 정의까지 다양합니다. 자세한 내용은 ToolbarExporter에 대한 API 문서를 참조하세요.

    다음은 React 템플릿을 통해 사용자 정의할 수 있는 몇 가지 옵션을 보여주는 스니펫입니다.

    <IgrGridToolbar key="toolbar">
        <IgrGridToolbarActions key="toolbarActions">
            <IgrGridToolbarExporter key="export" exportCSV="true" exportExcel="true" filename="exported_data"></IgrGridToolbarExporter>
        </IgrGridToolbarActions>
    </IgrGridToolbar>
    

    내보낸 파일 이름을 변경하는 것 외에도 사용자는 ToolbarExporting 이벤트를 기다리고 이벤트 속성에서 옵션 항목을 사용자 정의하여 내보내기 옵션을 추가로 구성할 수 있습니다.

    [!Note] By default when exporting to CSV the exporter exports using a comma separator and uses a '.csv' extension for the output file. You can customize these exporting parameters by subscribing to events of the exporter or changing the values of the exporter options fields. You can also cancel the export process by setting the cancel field of the event args to true.

    다음 코드 조각은 도구 모음 내보내기 이벤트를 구독하고 내보내기 옵션을 구성하는 방법을 보여줍니다.

    function configureExport(evt: IgrGridToolbarExportEventArgs) {
        const args = evt.detail;
        const options: IgrExporterOptionsBase = args.options;
    
        options.fileName = `Report_${new Date().toDateString()}`;
        (args.exporter as any).columnExporting.subscribe((columnArgs: any) => {
                columnArgs.cancel = columnArgs.header === 'Athlete' || columnArgs.header === 'Country';
        });
    }
    
    <IgrGrid toolbarExporting={configureExport}>
    </IgrGrid>
    

    다음 샘플은 내보낸 파일을 사용자 정의하는 방법을 보여줍니다.

    Exporting Indicator

    기본 도구 모음 내보내기 구성 요소를 사용하는 경우 내보내기 작업이 발생할 때마다 작업이 진행되는 동안 도구 모음에 진행률 표시기가 표시됩니다.

    또한 사용자는 도구 모음 ShowProgress 속성을 설정하고 장기 실행 작업에 사용하거나 그리드에서 발생하는 작업을 나타내는 또 다른 방법으로 사용할 수 있습니다.

    아래 샘플에는 진행률 표시줄을 볼 수 있도록 데이터 내보내기에 필요한 시간을 늘리기 위해 상당한 양의 데이터가 사용됩니다. 또한 그리드에서 장기 실행 작업을 시뮬레이션하는 또 다른 버튼이 있습니다.

    Styling

    사전 정의된 테마 외에도 사용 가능한 CSS 속성 중 일부를 설정하여 그리드를 추가로 사용자 정의할 수 있습니다. 일부 색상을 변경하려면 먼저 그리드에 대한 클래스를 설정해야 합니다.

    <IgrGrid className="grid"></IgrGrid>
    

    그런 다음 해당 클래스에 대한 관련 CSS 속성을 설정합니다.

    .grid {
        --ig-grid-toolbar-background-color: #2a2b2f;
        --ig-grid-toolbar-title-text-color: #ffcd0f;
        --ig-grid-toolbar-dropdown-background: #2a2b2f;
    }
    

    Demo

    API References

    Grid Toolbar 서비스에는 아래에 나열된 몇 가지 API가 더 있습니다.

    Additional Resources

    우리 커뮤니티는 활동적이며 항상 새로운 아이디어를 환영합니다.