Ignite UI for Web Components 서버에서 최소한의 데이터만 가져와서 사용자가 가능한 한 빨리 볼 수 있도록 렌더링할 수 있습니다. 그런 다음 사용자가 행을 확장한 후에만 해당 부모 행의 자식이 로드됩니다. 이 메커니즘은 Load on Demand라고도 하며, 모든 원격 데이터와 함께 작동하도록 쉽게 구성할 수 있습니다.
<!DOCTYPE html><html><head><title>Sample | Ignite UI | Web Components | infragistics</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" /><linkrel="stylesheet"href="/src/index.css"type="text/css" /></head><body><divid="root"><divclass="container sample"><divclass="container fill"><igc-tree-gridauto-generate="false"name="treeGrid"id="treeGrid"id="treeGrid"primary-key="ID"foreign-key="ParentID"><igc-columnfield="Name"data-type="string"sortable="true"editable="true"resizable="true"></igc-column><igc-columnfield="Title"header="Job Title"data-type="string"sortable="true"editable="true"resizable="true"></igc-column><igc-columnfield="Age"data-type="number"sortable="true"editable="true"resizable="true"></igc-column></igc-tree-grid></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
/* shared styles are loaded from: *//* https://static.infragistics.com/xplatform/css/samples */css
이 샘플이 마음에 드시나요? 당사의 완전한 Ignite UI for Web Components 툴킷에 액세스하여 몇 분 만에 나만의 앱을 빌드하기 시작하세요. 무료로 다운로드하세요.
용법
Load on Demand 기능은 두 가지 유형의 트리 그리드 데이터 원본(기본 및 외래 키 또는 하위 컬렉션)과 호환됩니다. 트리 그리드에서 루트 수준 데이터를 로드하고 데이터 원본 유형 중 하나에 필요한 키를 지정하기만 하면 됩니다. 사용자가 행을 확장할 때 자식 행을 로드하기 위해 트리 그리드는 콜백 입력 속성을 LoadChildrenOnDemand 제공합니다.
HasChildrenKey 속성은 설정할 필요가 없습니다. 제공하지 않으면 각 행에 확장 표시기가 표시됩니다. 자식이 없는 행을 확장한 후에도 정의되지 않았거나 빈 배열을 사용하여 done 콜백을 호출해야 합니다. 이 경우 로딩 표시기가 사라진 후에는 확장 표시기가 나타나지 않습니다.
사용자 지정 로딩 표시기를 제공하려는 경우 RowLoadingIndicatorTemplate 옵션을 사용하여 사용자 지정 템플릿을 설정할 수 있습니다. 다음 코드 조각은 설정 방법을 보여 줍니다.