I am trying to solve this issue:
Can you specify a different customCellRenderer to different rows in ag-grid Angular
In ag-grid's documentation, I found something that might help; under the section Many Renderers One Column, they have demonstrated something a bit similar to my need (see the plunker project).
In this particular part:
cellRendererSelector: function(params) {
var moodDetails = {
component: 'moodCellRenderer'
};
var genderDetails = {
component: 'genderCellRenderer',
params: {
values: ['Male', 'Female']
}
};
if (params.data.type === 'gender')
return genderDetails;
else if (params.data.type === 'mood')
return moodDetails;
else
return null;
}
In their example, they render the cell based on a value chosen in another column in the same row.
Intuitively, I tried the following:
if (params.node.id === 1)
return genderDetails;
else if (params.node.id === 5)
return moodDetails;
else
return null;
I thought that was supposed to work, but it didn't:
Any idea why this didn't work?