agSelectCellEditor dynamic list

I am using ag-grid and for any given row I would like the dropdown in one column to be dependent on the value of a different column. Can I do that with agSelectCellEditor or do I have to create a custom component.

2

1 Answer

You can define your cellEditorParams function in a way that returns different values depending on values of another column.

Here is a sample from the ag-grid site -

cellEditor : 'agSelectCellEditor'; cellEditorParams: function(params) { var selectedCountry = params.data.country; if (selectedCountry==='Ireland') { return { values: ['Dublin','Cork','Galway'] }; } else { return { values: ['New York','Los Angeles','Chicago','Houston'] }; } } 

Take a look at this example from official docs. You will have to replace agRichSelectCellEditor with agSelectCellEditor

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like