Reputation: 71
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
i tried to use "\n" "\r" "\br" but didnt work. 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 :
<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>
Upvotes: 0
Views: 1677
Reputation: 1254
Try like this
cellRenderer: function(param){
return param.data.DEALCAT + '<br/>' + param.data.DEALID;
}
Upvotes: 2