I am using the following code in the Column Definition :
{ headerName: 'Part', field: 'part',
cellStyle: {'background-color': 'cyan'}, editable: true,
cellEditor:'agSelectCellEditor', cellEditorParams:
I have other column in the grid ex-
{ headerName: 'Colour', field: 'colour',
cellStyle: {'background-color': 'cyan'}, editable: true,
cellEditor:'agSelectCellEditor', cellEditorParams: function(params) {
var selectedPart = params.data.type; if (selectedPart==='R&S') {
return { values: this.partTypeListRS }; } else if(selectedPart==='WiFi')
{ return { values: this.partTypeListWifi }; } else
if(selectedPart==='Other') { return { values: this.partTypeListOther };
}}},
}
I am getting the error cannot read property this.partTypeListRS of undefined ,if I click on a row where selectedPart==='R&S' condition is satisfied and respectively for all the other conditions .
Instead of function(params)
,I used the arrow function (params)=>
, then I was able to access this inside CellEditorParams