我正在开发一个使用Angular和Ag网格的应用程序。
columnDefs = [
...
{
headerName: 'LANG', field:'lang',
autoHeight: true,cellClass: 'cell-wrap-text',sortable: false, filter: true, editable: true,
cellEditor : 'agSelectCellEditor',
cellEditorParams : ['English', 'Spanish', 'French', 'Portuguese', '(other)'];
},
...
];
所以一切都很好,在编辑模式下,我得到了带有不同选项的组合框(“英语”、“西班牙语”、“法语”、“葡萄牙语”、“其他”)。
我的问题是,我需要让这些选项调用REST WS。
因此,我尝试在我的组件(optionValues)中定义一个变量,并用“ngonit”方法填充它,如下所示:
optionValues : any;
columnDefs = [
...
{
headerName: 'LANG', field:'lang',
autoHeight: true,cellClass: 'cell-wrap-text',sortable: false, filter: true, editable: true,
cellEditor : 'agSelectCellEditor',
cellEditorParams : this.optionValues,
},
...
];
ngOnInit(){
this.optionValues = this.http.get('http://localhost:8002/myservice');
}
你能帮帮我吗?