agSelectCellEditor dynamic list

后端 未结 1 1533
旧时难觅i
旧时难觅i 2020-12-22 05:29

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

相关标签:
1条回答
  • 2020-12-22 06:16

    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

    0 讨论(0)
提交回复
热议问题