Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何在angular ui grid cellFilter中访问整行数据_Angularjs_Angular Ui Grid - Fatal编程技术网

Angularjs 如何在angular ui grid cellFilter中访问整行数据

Angularjs 如何在angular ui grid cellFilter中访问整行数据,angularjs,angular-ui-grid,Angularjs,Angular Ui Grid,我想执行cellFilter,以编程方式定义单元格中需要显示的内容。定义列定义时,需要指定单元格对应的字段,但是我需要访问cellFilter中的整行数据,而不仅仅是单个字段。是否可以将多个字段传递给筛选器或整行 { name: 'To', field: 'myData', cellFilter: 'formatCaller' } 谢谢。是的,将此作为参数传递给筛选器将发送当前作用域 cellFilter: 'formatCaller:this` 然后在过滤器中,您可以访问该行,如下所示:

我想执行cellFilter,以编程方式定义单元格中需要显示的内容。定义列定义时,需要指定单元格对应的字段,但是我需要访问cellFilter中的整行数据,而不仅仅是单个字段。是否可以将多个字段传递给筛选器或整行

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

谢谢。

是的,将此作为参数传递给筛选器将发送当前作用域

cellFilter: 'formatCaller:this`
然后在过滤器中,您可以访问该行,如下所示:

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

您可以在此处找到更深入的解释(和plunker演示):(注意:我是作者)。

分享您迄今为止的尝试。该页面上的代码示例中有很多当前显示“未找到”或空白框。@ColtMcCormack我很抱歉!看起来有http/https混合内容被阻止。所有的plunker示例现在都应该可以使用了。我必须使用
scope.$parent.$parent.row.entity
。看起来有点粗糙,但我确实在我的网格中进行了一些分组,不确定这是否是原因。