简体   繁体   English

在 AG-GRID Angular 中插入电池断裂线

[英]Insering cell break line in AG-GRID Angular

Im displaying 2 data in one cell with ag-grid but i want the data to be with break line not like this: Data without break line我在一个带有 ag-grid 的单元格中显示 2 个数据,但我希望数据带有断线,而不是这样:没有断线的数据

i tried to use "\n" "\r" "\br" but didnt work.我尝试使用 "\n" "\r" "\br" 但没有用。 here is my code:这是我的代码:

    import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Grid, GridApi } from 'ag-grid-community';
import { AgGridAngular } from 'ag-grid-angular';
import { DealsService } from './services/deals.service';
import * as moment from 'moment';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'app';

columnDefs = [
{headerName: 'Class', cellRenderer: function(params){ return params.data.DEALCAT + params.data.DEALID},width:150, filter: true} ,

];

rowData : any;
constructor(private service:DealsService) {



}
dateFormatter(params){
return moment(params.value).format('DD/MM/YYYY');
}

ngOnInit() {
this.service.getDealsList().subscribe(data => {
this.rowData = data;
}); }

}

and here is the code html:这是代码 html:

<ag-grid-angular class="ag-theme-balham" ng-grid="gridOptions"
style="width: 1350px; height: 630px;"
class="ag-theme-alpine"
[rowData]="rowData"
[columnDefs]="columnDefs"

[animateRows]="true"
[paginationPageSize]="10"
[pagination]="true"
>
</ag-grid-angular>

Try like this像这样试试

cellRenderer: function(param){
    return param.data.DEALCAT + '<br/>' + param.data.DEALID;
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM