我有 ag-grid 表。我正在用按钮替换“Bookingxml”列数据。单击该按钮时,它应该在“out”div 中显示该特定单元格的数据。我浏览了文档并认为 cellRenderer 是这样做的方法。我尝试了下面的代码,但没有奏效。
var gridOptions = {
columnDefs: [
{headerName: 'Booking Type', field: 'BookingType', width: 200},
{headerName: 'Booking Error', field: 'BookingError', width: 150 },
{headerName: 'Booking Date', field: 'BookingDate', width: 150, filter: 'number', filterParams: {apply: true, newRowsAction: 'keep'}},
{
headerName: 'Booking XML', field: 'Bookingxml', width: 250,
cellRenderer: function (params) {
return '<button ng-click="display()">View XML</button>';
}
}
],
enableColResize: true,
enableSorting: true,
enableFilter: true
};
return gridOptions;
}
function display(xml) {
$('#out').html(params.value);
}