Web Components Tree Grid의 Ignite UI for Web Components 행 편집 기능을 사용하면 IgcTreeGridComponent 내에서 직접 데이터를 편집할 수 있습니다. 데이터를 조작하는 이 편리한 방법 외에도 전체 CRUD 작업을 위한 강력한 API가 있습니다. 행을 클릭하고 Enter 키를 눌러 그리드 행 편집을 수행할 수 있습니다. 또 다른 빠른 방법은 수정해야 하는 행을 마우스로 두 번 클릭하는 것입니다.
Web Components 트리 그리드 행 편집 예제
다음 샘플에서는 행 편집을 사용하도록 설정하는 방법을 보여 줍니다 IgcTreeGridComponent. 셀 값을 변경한 다음 같은 행의 다른 셀을 클릭하거나 탐색하면 완료 단추를 사용하여 확인하거나 취소 단추를 사용하여 취소 할 때까지 행 값이 업데이트되지 않습니다.
<!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 ig-typography"><divclass="container fill"><igc-tree-gridauto-generate="false"name="treeGrid"id="treeGrid"id="treeGrid"primary-key="ID"foreign-key="ParentID"moving="true"row-editable="true"row-selection="multiple"><igc-columnfield="Name"header="Full Name"data-type="string"resizable="true"sortable="true"filterable="true"editable="true"></igc-column><igc-columnfield="Age"data-type="number"resizable="false"sortable="false"filterable="false"editable="true"></igc-column><igc-columnfield="Title"data-type="string"resizable="true"sortable="true"filterable="true"editable="true"></igc-column><igc-columnfield="HireDate"header="Hire Date"data-type="date"resizable="true"sortable="true"filterable="true"editable="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 툴킷에 액세스하여 몇 분 만에 나만의 앱을 빌드하기 시작하세요. 무료로 다운로드하세요.
행이 편집 모드에 있을 때 다른 행의 셀을 클릭하면 "완료" 버튼을 누른 것처럼 작동하여 이전 행의 모든 변경 사항을 제출합니다. 새로 포커스가 맞춰진 셀을 편집할 수 있는 경우 새 행도 편집 모드로 전환됩니다. 그러나 셀을 편집할 수 없는 경우에는 이전 행만 편집 모드를 종료합니다.
constructor() {
var grid = document.getElementById('grid') as IgcTreeGridComponent;
grid.data = this.data;
}
ts
행 편집 작업에는 기본 키 설정이 필수입니다.
개별 열에 대한 편집을 활성화할 필요는 없습니다. IgcTreeGridComponent의 rowEditable 속성을 사용하면 정의된 필드 속성(기본 행 제외)이 있는 모든 행을 편집할 수 있습니다. 특정 열에 대한 편집을 비활성화하려면 해당 열의 편집 가능한 입력을 false로 설정하기만 하면 됩니다.
IgcTreeGridComponent는 행 상태가 제출되거나 취소될 때까지 보류 중인 셀 변경 내용을 보유하는 내부 공급자인 BaseTransactionService를 활용합니다.
포지셔닝
오버레이의 기본 위치는 편집 모드에 있는 행 아래에 있습니다.
행 아래에 공간이 없으면 행 위에 오버레이가 나타납니다.
상단 또는 하단에 표시된 오버레이는 오버레이가 닫힐 때까지 스크롤하는 동안 이 위치를 유지합니다.
행동
행이 편집 모드인 경우 동일한 행의 셀을 클릭하면 편집이 계속됩니다.
"완료" 버튼을 클릭하면 행 편집이 완료되고 데이터 소스 또는 가능한 경우 트랜잭션에 변경 사항이 제출됩니다. 또한 행은 편집 모드를 종료합니다.
"취소" 버튼을 클릭하면 행의 현재 변경 사항이 모두 되돌려지고 행은 편집 모드를 종료합니다.
행이 편집 모드인 경우 다른 행의 셀을 클릭하면 현재 행 편집이 완료되고 새 행 변경 사항이 제출됩니다("완료" 버튼을 클릭하는 것과 동일한 동작). 포커스를 받은 새 셀이 편집 가능하면 새 행도 편집 모드로 들어가고, 셀을 편집할 수 없으면 이전 행만 편집 모드에서 나갑니다.
<!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 ig-typography"><divclass="container fill"><igc-tree-gridauto-generate="false"name="grid"id="grid"id="grid"primary-key="ID"foreign-key="ParentID"moving="true"row-editable="true"row-selection="multiple"><igc-columnfield="Name"header="Full Name"data-type="string"resizable="true"sortable="true"filterable="true"editable="true"></igc-column><igc-columnfield="Age"data-type="number"resizable="false"sortable="false"filterable="false"editable="true"></igc-column><igc-columnfield="Title"data-type="string"resizable="true"sortable="true"filterable="true"editable="true"></igc-column><igc-columnfield="HireDate"header="Hire Date"data-type="date"resizable="true"sortable="true"filterable="true"editable="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