Web Components Grid의 Ignite UI for Web Components 행 작업 기능을 통해 개발자는 행/셀 구성 요소 및 행 고정에 CRUD를 사용하고 IgcActionStrip 활용할 수 있습니다. 이러한 작업에 대해 편집 및 고정의 특정 행에 적용할 수 있는 몇 가지 미리 정의된 UI 컨트롤이 IgcGridComponent 있습니다.
When ActionStripComponent is a child component of the IgcGridComponent, hovering a row will automatically show the UI.
Custom Implementation
이러한 구성 요소는 사용자 지정을 위한 유연성을 제공하는 템플릿을 노출합니다. 예를 들어, IgcActionStrip 다음과 같은 행 작업이 있는 Gmail 시나리오의 경우 삭제하다, 편집하다 그리고 등등. 아이콘이 있는 버튼 구성 요소를 만들고 클릭 이벤트를 추가하고 삽입하기만 하면 됩니다. IgcActionStrip.
import { IgcPropertyEditorPanelModule } from'igniteui-webcomponents-layouts';
import'igniteui-webcomponents-grids/grids/combined';
import { ComponentRenderer, PropertyEditorPanelDescriptionModule, WebGridDescriptionModule } from'igniteui-webcomponents-core';
import { IgcGridComponent, IgcPinningConfig, RowPinningPosition, IgcActionStripComponent, IgcColumnComponent } from'igniteui-webcomponents-grids/grids';
import NwindData from'./NwindData.json';
import"igniteui-webcomponents-grids/grids/themes/light/bootstrap.css";
import { ModuleManager } from'igniteui-webcomponents-core';
import"./index.css";
ModuleManager.register(
IgcPropertyEditorPanelModule
);
exportclassSample{
private grid: IgcGridComponent
private _pinningConfig1: IgcPinningConfig | null = null;
publicgetpinningConfig1(): IgcPinningConfig {
if (this._pinningConfig1 == null)
{
var pinningConfig1: IgcPinningConfig = {} as IgcPinningConfig;
pinningConfig1.rows = RowPinningPosition.Top;
this._pinningConfig1 = pinningConfig1;
}
returnthis._pinningConfig1;
}
private actionStrip: IgcActionStripComponent
private productName: IgcColumnComponent
private unitPrice: IgcColumnComponent
private unitsOnOrder: IgcColumnComponent
private unitsInStock: IgcColumnComponent
private quantityPerUnit: IgcColumnComponent
private reorderLevel: IgcColumnComponent
private discontinued: IgcColumnComponent
private _bind: () =>void;
constructor() {
var grid = this.grid = document.getElementById('grid') as IgcGridComponent;
var actionStrip = this.actionStrip = document.getElementById('actionStrip') as IgcActionStripComponent;
var productName = this.productName = document.getElementById('ProductName') as IgcColumnComponent;
var unitPrice = this.unitPrice = document.getElementById('UnitPrice') as IgcColumnComponent;
var unitsOnOrder = this.unitsOnOrder = document.getElementById('UnitsOnOrder') as IgcColumnComponent;
var unitsInStock = this.unitsInStock = document.getElementById('UnitsInStock') as IgcColumnComponent;
var quantityPerUnit = this.quantityPerUnit = document.getElementById('QuantityPerUnit') as IgcColumnComponent;
var reorderLevel = this.reorderLevel = document.getElementById('ReorderLevel') as IgcColumnComponent;
var discontinued = this.discontinued = document.getElementById('Discontinued') as IgcColumnComponent;
this._bind = () => {
grid.data = this.nwindData;
grid.pinning = this.pinningConfig1;
}
this._bind();
}
private _nwindData: any[] = NwindData;
publicgetnwindData(): any[] {
returnthis._nwindData;
}
private _componentRenderer: ComponentRenderer = null;
publicgetrenderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
PropertyEditorPanelDescriptionModule.register(context);
WebGridDescriptionModule.register(context);
}
returnthis._componentRenderer;
}
}
new Sample();
ts
<!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-gridauto-generate="false"name="grid"id="grid"row-editable="true"allow-filtering="true"primary-key="ProductID"><igc-action-stripname="actionStrip"id="actionStrip"><igc-grid-pinning-actions
></igc-grid-pinning-actions><igc-grid-editing-actionsedit-row="true"delete-row="true"add-row="true"></igc-grid-editing-actions></igc-action-strip><igc-columnname="ProductName"id="ProductName"field="ProductName"header="Product Name"></igc-column><igc-columnname="UnitPrice"id="UnitPrice"field="UnitPrice"header="Unit Price"></igc-column><igc-columnname="UnitsOnOrder"id="UnitsOnOrder"field="UnitsOnOrder"header="Units On Order"></igc-column><igc-columnname="UnitsInStock"id="UnitsInStock"field="UnitsInStock"header="Units In Stock"></igc-column><igc-columnname="QuantityPerUnit"id="QuantityPerUnit"field="QuantityPerUnit"header="Quantity Per Unit"></igc-column><igc-columnname="ReorderLevel"id="ReorderLevel"field="ReorderLevel"header="Reorder Level"></igc-column><igc-columnname="Discontinued"id="Discontinued"field="Discontinued"header="Discontinued"></igc-column></igc-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
Like this sample? Get access to our complete Ignite UI for Web Components toolkit and start building your own apps in minutes. Download it for free.