How to access whole row data in angular -ui-grid cellFilter

I would like to execute cellFilter to programmatically determine what should be displayed inside the cell. When defining column definitions, you need to specify in which field the cell corresponds, however I need access to the entire data row in cellFilter, and not just to one field. Is it possible to pass multiple fields to a filter or the entire string?

{
name: 'To',
field: 'myData',
cellFilter: 'formatCaller'
}

Thank.

+4
source share
1 answer

Yes, passing thisas an argument to your filter sends the current scope

cellFilter: 'formatCaller:this`

Then in your filter, you can access the string as follows:

app.filter('formatCaller', function () {
  return function (value, scope) {
    return scope.row.entity.whateverField + ' ' + yourFormattingFunction(value);
  };
});

( plunker): http://brianhann.com/6-ways-to-take-control-of-how-your-ui-grid-data-is-displayed/ (caveat: ).

+8

All Articles