[英]Edit icon not displaying in ag-grid
版本:
角度:10.0.10
@angular/cli 10.0.6
我使用以下命令安裝引導程序
見代碼:
app.module.ts
@NgModule({
bootstrap: [AppComponent]
})
注冊.component.cs
import { Component, OnInit } from '@angular/core';
import { BackendserviceService } from '../backendservice.service';
@Component({
selector: 'app-registration',
templateUrl: './registration.component.html',
styleUrls: ['./registration.component.css']
})
export class RegistrationComponent implements OnInit {
columnDefs = [
{ headerName: 'empid', field: 'empid' },
{ headerName: 'username', field: 'username' },
{ headerName: 'empaddress', field: 'empaddress' },
{ headerName: 'password', field: 'password' },
{ headerName: 'country', field: 'country' },
{
headerName: 'Edit',
template:
'<span><i class="fa fa-edit" data-action-type="edit"></i></span>',
}
];
當我點擊編輯圖標檢查
替換這一行
template: '<span><i class="fa fa-edit" data-action-type="edit"></i></span>',
和
cellRenderer: () => '<span><i class="fa fa-edit" data-action-type="edit"></i></span>',
有關更多信息,請參閱單元格渲染器部分
有很多方法可以設置 font-awesome,但是如果你想快速設置,只需將 font-awesome css 文件添加到你的 index.html
<!DOCTYPE html>
<html lang="en">
<head>
...
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.1.0/css/all.css"
/>
</head>
</html>
您需要使用 Ag-grid Cell Renderer。
cellRenderer: (params) => {return '<span><i class="fa fa-edit" data-action-type="edit"></i></span>'}
有關更多詳細信息,請閱讀 - https://www.ag-grid.com/javascript-grid-cell-rendering-components/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.