简体   繁体   English

如何在ag-grid中过滤数组以获取列定义

[英]How to filter array inside ag-grid for a column definition

I am changing my grid from dataTable to ag-grid . 我将网格从dataTable更改为ag-grid When using DataTable, I was taking first element from attributes array where typeName='ItemType'. 使用DataTable时,我是从属性数组中获取第一个元素的,其中typeName ='ItemType'。 I want to implement the same functionality using ag-grid. 我想使用ag-grid实现相同的功能。 How an achieve the same. 怎么做到一样。

<tr ng-repeat="e in entities">
    <td>
        <span ng-repeat="c in e.attributes | filter:{typeName:'ItemType'}:true">
                                                            {{c.configValue}}
        </span>
    </td>
</tr>

In ag-grid syntax, i have to display same value as I used in dataTable. 在ag-grid语法中,我必须显示与dataTable中使用的值相同的值。

var columnDefs = [
   { headerName: "Type", field: "attributes", width: 150},//ItemType
   { headerName: "Brand", field: "attributes", width: 150 }//Brand
];

You can use cell Render to customise the rendering or your cell. 您可以使用单元格渲染自定义渲染或单元格。

Moreover there is a option angularCompileRows to compile the template that you return from the cellRender function. 此外,还有一个angularCompileRows选项可以编译从cellRender函数返回的模板。

Check : http://ag-grid.com/javascript-grid-properties/index.php for properties and http://ag-grid.com/angular-grid-cell-rendering/index.php for cellRendering 检查: http : //ag-grid.com/javascript-grid-properties/index.php获取属性, http: //ag-grid.com/angular-grid-cell-rendering/index.php获取cellRendering

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM