agSelectCellEditor dynamic list

孤人 提交于 2019-11-28 12:11:12

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/54712974/agselectcelleditor-dynamic-list

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!