Michael Woywod Michael Woywod - 1 month ago 20
AngularJS Question

Angular ui-grid editDropdownOptionsArray depending on current row

I want to have a different dropdown array for each row of my ui-grid. Therefore I need to access the current row. I had something like this in mind but I don't know how to access the current row within columnDefs. Is there an easy way to achieve this?

columnDefs: [
{ name: "id", field: "id"},
{ name: "firends", field: "friends", editableCellTemplate: 'ui-grid/dropdownEditor', editDropdownOptionsArray: findFriendsForId(row.id)
]

var findFriendsForId = function(id) {
// find friends and return them as array
}

Answer

Ok I figured it out by myself. There is a function called editDropdownOptionsFunction.

Here is an example of it.